data_migrate 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +5 -0
- data/README.md +4 -30
- data/data_migrate.gemspec +5 -1
- data/lib/data_migrate/version.rb +1 -1
- data/lib/generators/data_migration/data_migration_generator.rb +3 -6
- metadata +12 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b408b7360d8bf4c8d9eae51ede9bcd9f2e15a44
|
4
|
+
data.tar.gz: 89eeaec81959c73838e764006d2eecb558fca925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328b8f8c3e1f33277bf3ece1abd0b4a8a602ec9f0ff982dfa788e7e157f4f76507ba8e18c15c3ce636bbe932f7864040ae5381ada8cb5664cd8adf514b3b70fc
|
7
|
+
data.tar.gz: 7517e1f6bd66f96c7d503e463c9c1249d89f33160d6bf0a4a7998b9adc8a21a5b9faf16489542018f568386b1fb5528971120db3467bb27464426350424ef747
|
data/Changelog.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 3.0.0
|
5
|
+
|
6
|
+
`--skip-schema-migration` removed deprecated. This gem will no longer generate schema
|
7
|
+
migrations. It still supports running schema/data migrations with one command.
|
8
|
+
|
4
9
|
## 2.2.0
|
5
10
|
|
6
11
|
([bilby91](https://github.com/bilby91)) Capistrano support
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Data Migrate
|
|
6
6
|
|
7
7
|
Run data migrations alongside schema migrations.
|
8
8
|
|
9
|
-
Data migrations are stored in db/data
|
9
|
+
Data migrations are stored in `db/data`. They act like schema
|
10
10
|
migrations, except they should be reserved for data migrations. For
|
11
11
|
instance, if you realize you need to titleize all your titles, this
|
12
12
|
is the place to do it.
|
@@ -35,7 +35,7 @@ just the text. "Frist!!1!1" rules the day. Given that you:
|
|
35
35
|
- drop the Comment model
|
36
36
|
- fix all your test/controller/view mojo.
|
37
37
|
|
38
|
-
You've just got bit. When you rake setup:development
|
38
|
+
You've just got bit. When you `rake setup:development`, the mess gets
|
39
39
|
mad at you after it creates your database, and starts cranking through
|
40
40
|
migrations. It gets to the part where you iterate over the comments
|
41
41
|
and it blows up. You don't have a comment model anymore for it to
|
@@ -56,25 +56,17 @@ test your migration, so you have the choice of `db:migrate:with_data` or
|
|
56
56
|
What's it do?
|
57
57
|
-------------
|
58
58
|
|
59
|
-
Data migrations are stored in db/data
|
59
|
+
Data migrations are stored in `db/data`. They act like schema
|
60
60
|
migrations, except they should be reserved for data migrations. For
|
61
61
|
instance, if you realize you need to titleize all yours titles, this
|
62
62
|
is the place to do it. Running any of the provided rake tasks also
|
63
63
|
creates a data schema table to mirror the usual schema migrations
|
64
64
|
table to track all the goodness.
|
65
65
|
|
66
|
-
Data migrations can be created at the same time as schema migrations,
|
67
|
-
or independently. Database (db:) tasks have been added and extended
|
68
|
-
to run on data migrations only, or in conjunction with the schema
|
69
|
-
migration. For instance, `rake db:migrate:with_data` will run both
|
70
|
-
schema and data migrations in the proper order.
|
71
|
-
|
72
|
-
Note: If a data and schema migration share the same version number, schema gets precedence when migrating up. Data does down.
|
73
|
-
|
74
66
|
Rails Support
|
75
67
|
--------------------
|
76
68
|
|
77
|
-
Rails 3.1: Version 1.2 supports Rails 3.1.0 and higher **but** is
|
69
|
+
Rails 3.1: Version 1.2 supports Rails 3.1.0 and higher **but** is no longer maintained.
|
78
70
|
|
79
71
|
Rails 4: Version 2.0 supports Rails 4.0 and higher
|
80
72
|
|
@@ -113,15 +105,6 @@ You can generate a data migration as you would a schema migration:
|
|
113
105
|
|
114
106
|
rails g data_migration add_this_to_that
|
115
107
|
|
116
|
-
By default, the migration also generates a schema migration by the same name.
|
117
|
-
This allows you to do things like:
|
118
|
-
|
119
|
-
rails g data_migration add_this_to_that this:string
|
120
|
-
|
121
|
-
If you need a data only migration, either run it as such, with the skip-schema-migration flag:
|
122
|
-
|
123
|
-
rails g data_migration add_this_to_that --skip-schema-migration
|
124
|
-
|
125
108
|
### Rake Tasks
|
126
109
|
|
127
110
|
$> rake -T data
|
@@ -146,15 +129,6 @@ Tasks work as they would with the 'vanilla' db version. The 'with_data' additio
|
|
146
129
|
|
147
130
|
With 'up' and 'down', you can specify the option 'BOTH', which defaults to false. Using true, will migrate both the data and schema (in the desired direction) if they both match the version provided. Again, going up, schema is given precedence. Down its data.
|
148
131
|
|
149
|
-
For more example, assume you have the 2 files:
|
150
|
-
db/migrate/20110419021211_add_x_to_y.rb
|
151
|
-
db/data/20110419021211_add_x_to_y.rb
|
152
|
-
|
153
|
-
Running `rake db:migrate:up:with_data VERSION=20110419021211` would execute the 'db/migrate' version.
|
154
|
-
Running `rake db:migrate:up:with_data VERSION=20110419021211` would execute the 'db/migrate' version, followed by the 'db/data' version.
|
155
|
-
|
156
|
-
Going down instead of up would be the opposite.
|
157
|
-
|
158
132
|
`rake db:migrate:status:with_data` provides and additional column to indicate which type of migration.
|
159
133
|
|
160
134
|
Capistrano Support
|
data/data_migrate.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Andrew J Vargo", "Ilya Katz"]
|
10
10
|
s.email = ["ajvargo@computer.org", "ilyakatz@gmail.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://github.com/ilyakatz/data-migrate"
|
12
12
|
s.summary = %q{Rake tasks to migrate data alongside schema changes.}
|
13
13
|
s.description = %q{Rake tasks to migrate data alongside schema changes.}
|
14
14
|
s.license = "MIT"
|
@@ -21,4 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
23
|
s.require_paths = ["lib"]
|
24
|
+
|
25
|
+
s.post_install_message = %q{
|
26
|
+
Note: --skip-schema-migration option is no longer available as of version 3.0.0
|
27
|
+
}
|
24
28
|
end
|
data/lib/data_migrate/version.rb
CHANGED
@@ -8,18 +8,15 @@ module DataMigrate
|
|
8
8
|
namespace "data_migration"
|
9
9
|
include Rails::Generators::Migration
|
10
10
|
|
11
|
-
argument :attributes, :
|
12
|
-
class_option :skip_schema_migration, :desc => 'Dont generate database schema migration file.', :type => :boolean
|
11
|
+
argument :attributes, type: :array, default: [], banner: 'field:type field:type'
|
13
12
|
|
14
13
|
def create_data_migration
|
15
14
|
set_local_assigns!
|
16
|
-
|
17
|
-
migration_template "migration.rb", "db/migrate/#{file_name}.rb"
|
18
|
-
end
|
19
|
-
migration_template "data_migration.rb", "db/data/#{file_name}.rb"
|
15
|
+
migration_template 'data_migration.rb', "db/data/#{file_name}.rb"
|
20
16
|
end
|
21
17
|
|
22
18
|
protected
|
19
|
+
|
23
20
|
attr_reader :migration_action
|
24
21
|
|
25
22
|
def self.next_migration_number(dirname)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew J Vargo
|
@@ -9,20 +9,20 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '4.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '4.0'
|
28
28
|
description: Rake tasks to migrate data alongside schema changes.
|
@@ -33,7 +33,7 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
-
-
|
36
|
+
- .gitignore
|
37
37
|
- Changelog.md
|
38
38
|
- Gemfile
|
39
39
|
- LICENSE
|
@@ -54,27 +54,29 @@ files:
|
|
54
54
|
- lib/generators/data_migration/templates/migration.rb
|
55
55
|
- tasks/.gitkeep
|
56
56
|
- tasks/databases.rake
|
57
|
-
homepage:
|
57
|
+
homepage: https://github.com/ilyakatz/data-migrate
|
58
58
|
licenses:
|
59
59
|
- MIT
|
60
60
|
metadata: {}
|
61
|
-
post_install_message:
|
61
|
+
post_install_message: |2
|
62
|
+
|
63
|
+
Note: --skip-schema-migration option is no longer available as of version 3.0.0
|
62
64
|
rdoc_options: []
|
63
65
|
require_paths:
|
64
66
|
- lib
|
65
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
68
|
requirements:
|
67
|
-
- -
|
69
|
+
- - '>='
|
68
70
|
- !ruby/object:Gem::Version
|
69
71
|
version: '0'
|
70
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
73
|
requirements:
|
72
|
-
- -
|
74
|
+
- - '>='
|
73
75
|
- !ruby/object:Gem::Version
|
74
76
|
version: '0'
|
75
77
|
requirements: []
|
76
78
|
rubyforge_project: data_migrate
|
77
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.0.14.1
|
78
80
|
signing_key:
|
79
81
|
specification_version: 4
|
80
82
|
summary: Rake tasks to migrate data alongside schema changes.
|