wukong-migrate 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2RlYzkzMTE2NDhhY2Q2MDdlMzNlNzMyMGZjYjAwNDVkOGQyMDJmYQ==
4
+ MTY1Mjk1ZTgyNjFiOWEyNDdmODZkMDRkYzI0YzdlYWEwYTRiZjY0Nw==
5
5
  data.tar.gz: !binary |-
6
- YTczYjgyM2ExYzRhYmZkMmY0MTQ4YWVjMjQ4OTZlZjE2YWE4OGFhZQ==
6
+ NzM0YjYzZTI4N2Y3MzY1ODE5MGRiNGNjZTVkMWFkNjA1N2Q1NzEyYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDI3MjQ0MGQxYTJkMmViZjgyMDA1MDg5MTEwNjI5YTQyMWE0MTUwNmFiOWE0
10
- ZGNlMDYyNmRmZDRkZDdlNjdhNjAzMDc5NDBhNmYxMzlkMTNlZWRmODQxMjhi
11
- ZWNlN2YwOGIyYWJlM2MzODliMGJjYTY3OWM4YjU2OWI4ZDdmYTU=
9
+ ZTc2NzM2YTg1N2FlNWYxZGNmNDdlYjk4MWE2ZjgwZGU5MzZkYTE4YjY3OWY2
10
+ ODg3OTVmNmYzMjE5Y2YyZjI5ZmMwZjU1YjU5NWUxMmM0Yjg1ZmMwZmVjNDUy
11
+ ZDc5ZTUyYmIzYWNkOTgyNmRjODc3YzJmZjFmOTljMTk2ZWE2OTQ=
12
12
  data.tar.gz: !binary |-
13
- YWM1MWMyOWI4YjQwOTU4OTgzOWY4ODQ3MGI2ZDA3MDUzMDIyZDljZTU1NGI1
14
- Yjk0MGNjYmRiZDdlY2JjOTkzNjliNWY3YjIzZWY1NDcwMzY4MjRmZTIwOGVm
15
- MWM5NWI5NTg1MTA2OTEzYzM1MDc5MTA3NWY0ZTg2MTBlMGVhNDA=
13
+ NTU1YjRlYjliZTBmZDZlNzY1NDE4OWU0ZmQwMmM2NzgxZGViMDg2YWQ0ODlk
14
+ ZjUwZjhmOGVjZjIxNjFhN2RkNzEyMTE2YTIxNjBiOTI4ZTU5M2I3NmExOTZh
15
+ OTgwYzYxM2NjZjFkMGY1NWNlNTliYjUzZThlM2QyODY0NWRiMWI=
@@ -0,0 +1,75 @@
1
+ # Wukong Migrate
2
+
3
+ A Wukong plugin that allows you to update database schema using predefined models from your deploy pack and a migration DSL.
4
+
5
+ ## Commands
6
+
7
+ The following commands are available
8
+
9
+ ### Generate
10
+
11
+ Creates a new migration file templated to match the chosen database. This command will create a new ruby file in `db/migrate` named after the argument supplied to `generate`. The only currently supported database is Elasticsearch, with future plans to support Hbase and others.
12
+
13
+ ```
14
+ $ bundle exec wu-migrate generate change_schema --db=elasticsearch
15
+ # INFO 2013-07-29 14:14:51 [MigrateRunner ] -- Creating migration: db/migrate/change_schema.rb
16
+ ```
17
+
18
+ ### Perform
19
+
20
+ Performs the specified migration. This will talk to the database directly and apply the changes found in the migration. The tool will only perform migrations found in db/migrate, and specifying the `.rb` extension is not necessary. Currently, this is NOT an idempotent operation, and makes no guarantee of data safety on multiple invocations. Configuration is derived from command line parameters and through `Wukong::Deploy` settings.
21
+
22
+ ```
23
+ $ bundle exec wu-migrate perform change_schema --db=elasticsearch
24
+ # INFO 2013-07-29 14:18:20 [MigrateRunner ] -- Creating index jedi
25
+ # INFO 2013-07-29 14:18:21 [MigrateRunner ] -- Operation complete
26
+ # INFO 2013-07-29 14:18:21 [MigrateRunner ] -- Add alias :light_side for index jedi
27
+ # INFO 2013-07-29 14:18:21 [MigrateRunner ] -- Operation complete
28
+ ```
29
+
30
+ ### All
31
+
32
+ Performs all available migrations in `db/migrate`. This is useful when setting up mirrored or development databases from existing migrations.
33
+
34
+ ## Syntax
35
+
36
+ The following syntax is used to define migrations.
37
+
38
+ ### Elasticsearch
39
+
40
+ All definitions take place inside of a `.define` block.
41
+
42
+ ```ruby
43
+ EsMigration.define 'name_of_migration' do
44
+ ...
45
+ end
46
+ ```
47
+ Top-level methods are `create_index`, `update_index`, and `delete_index`. They can be used with or without block syntax.
48
+
49
+ ```ruby
50
+ EsMigration.define 'name_of_migration' do
51
+ create_index(:index_name) do
52
+ ...
53
+ end
54
+ delete_index(:old_index)
55
+ end
56
+ ```
57
+
58
+ Inside of an index block, you have access to mappings, aliases and index-level settings. Aliases are created/deleted one at a time and optionally accept filters. Mapping methods accept blocks for object-level settings.
59
+
60
+ ```ruby
61
+ EsMigration.define 'name_of_migration' do
62
+ create_index(:index_name) do
63
+ number_of_replicas 4
64
+ ...
65
+ alias_to :other_name, filter: { range: { date: { gt: '2013-05-05' } } }
66
+ remove_alias :prior_name
67
+ create_mapping(:obj_type) do
68
+ dynamic true
69
+ source false
70
+ ...
71
+ end
72
+ end
73
+ delete_index(:old_index)
74
+ end
75
+ ```
@@ -6,7 +6,17 @@ module Wukong
6
6
 
7
7
  description <<-DESC.gsub(/^ {8}/, '').strip
8
8
  Use this tool to create and perform database migrations using models
9
- defined in app/models.
9
+ defined in app/models. Options may be passed in as params on the commandline,
10
+ else are discovered using Wukong::Deploy.settings
11
+
12
+ $ wu-migrate generate schema_change --db=elasticsearch
13
+ # Creates a template Elasticsearch migration file in db/migrate/schema_change.rb
14
+
15
+ $ wu-migrate perform schema_change --db=elasticsearch
16
+ # Interprets and runs the migration db/migrate/schema_change.rb
17
+
18
+ $ wu-migrate all
19
+ # Runs all migrations found in db/migrate
10
20
 
11
21
  Commands:
12
22
 
@@ -1,5 +1,5 @@
1
1
  module Wukong
2
2
  module Migrate
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -11,7 +11,11 @@ Gem::Specification.new do |gem|
11
11
 
12
12
  gem.summary = 'Wukong utility to push database schema changes based upon your defined models'
13
13
  gem.description = <<-DESC.gsub(/^ {4}/, '')
14
- wukong-migrate, inspired by rails, all up in yer deploy pack, pushing yer schema changes
14
+ Wukong-migrate, inspired by rails, makes updating database schemas and settings painless and straightforward.
15
+
16
+ Utilizing your app's models and the settings discovered by Wukong-deploy, only a simple migrate script is required
17
+ to be able to make changes to databases. Keep your databases in sync with your app code more cleanly and with less
18
+ effort.
15
19
  DESC
16
20
 
17
21
  gem.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wukong-migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Dempsey
@@ -66,8 +66,17 @@ dependencies:
66
66
  - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.8.7
69
- description: ! 'wukong-migrate, inspired by rails, all up in yer deploy pack, pushing
70
- yer schema changes
69
+ description: ! 'Wukong-migrate, inspired by rails, makes updating database schemas
70
+ and settings painless and straightforward.
71
+
72
+
73
+ Utilizing your app''s models and the settings discovered by Wukong-deploy, only
74
+ a simple migrate script is required
75
+
76
+ to be able to make changes to databases. Keep your databases in sync with your app
77
+ code more cleanly and with less
78
+
79
+ effort.
71
80
 
72
81
  '
73
82
  email: coders@infochimps.com
@@ -78,6 +87,7 @@ extra_rdoc_files: []
78
87
  files:
79
88
  - .gitignore
80
89
  - Gemfile
90
+ - README.md
81
91
  - Rakefile
82
92
  - bin/wu-migrate
83
93
  - lib/gorillib/model/elasticsearch_ext.rb