data_migrate 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -2
- data/Appraisals +4 -0
- data/Changelog.md +5 -1
- data/Gemfile.rails5.1 +5 -0
- data/README.md +34 -21
- data/data_migrate.gemspec +1 -1
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/lib/data_migrate/version.rb +1 -1
- data/screenshot.png +0 -0
- metadata +29 -34
- data/spec/db/test.db +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf69bd4a2c1fb2dc456bf88df16a89b06ea7b7dd
|
4
|
+
data.tar.gz: 0836666a623ae289792dcba1b0422c98c9cd87cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93da479ae6eb63a85d954d6a140e30578e7e511b4bec44aa0c952fb09e98e7b62bfd2f3661147872e3c08d28c245197582aa49c24012fe1615e3d680241b2d40
|
7
|
+
data.tar.gz: 6d11fcff914918d0b2f1f5575e9f08cfcabf16ae912a98837bcc43e5407695b75f8b7300b32bf7ead08729946fb37ec7291c386ea6066a99b598962fc5e7a65d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.0.0-p648
|
4
|
-
- 2.1.10
|
5
3
|
- 2.2.6
|
6
4
|
- 2.3.4
|
7
5
|
script: bundle exec rspec
|
@@ -10,6 +8,7 @@ gemfile:
|
|
10
8
|
- gemfiles/rails_4.1.gemfile
|
11
9
|
- gemfiles/rails_4.2.gemfile
|
12
10
|
- gemfiles/rails_5.0.gemfile
|
11
|
+
- gemfiles/rails_5.1.gemfile
|
13
12
|
matrix:
|
14
13
|
exclude:
|
15
14
|
- rvm: 2.0.0-p648
|
data/Appraisals
CHANGED
data/Changelog.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 3.2.0
|
5
|
+
- Add support for Rails 5.1
|
6
|
+
- No longer testing EOL rubies
|
7
|
+
|
4
8
|
## 3.1.0
|
5
9
|
|
6
10
|
Rails 5.0 support thanks to
|
7
|
-
[jturkel](https://github.com/jturkel) and [
|
11
|
+
[jturkel](https://github.com/jturkel) and [abreckner](https://github.com/abreckner)
|
8
12
|
|
9
13
|
## 3.0.1
|
10
14
|
|
data/Gemfile.rails5.1
ADDED
data/README.md
CHANGED
@@ -13,6 +13,8 @@ migrations, except they should be reserved for data migrations. For
|
|
13
13
|
instance, if you realize you need to titleize all your titles, this
|
14
14
|
is the place to do it.
|
15
15
|
|
16
|
+
![Travis](./screenshot.png)
|
17
|
+
|
16
18
|
# Why should I use this?
|
17
19
|
|
18
20
|
Its seems when a project hits a certain size, I get to manipulate data
|
@@ -26,35 +28,37 @@ migration. It'd be much better to keep concerns separate. The benefit
|
|
26
28
|
of having them separate has to do with your data model.
|
27
29
|
|
28
30
|
For instance, lets take an absurd example, to illustrate: You have
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
- write a migration to
|
35
|
-
-
|
36
|
-
- drop the
|
37
|
-
-
|
31
|
+
a blog application that has posts with many comments.
|
32
|
+
After some use, you decide you are going to be a trend setter,
|
33
|
+
and want only one comment per post, and just the text.
|
34
|
+
|
35
|
+
Given that you:
|
36
|
+
- write a migration to add a comment column to `Post`
|
37
|
+
- write a migration to move the contents of the first comments to the `Post`
|
38
|
+
- drop the `column_id` column from `Post`
|
39
|
+
- drop the `Comment` model
|
40
|
+
- fix all your tests
|
38
41
|
|
39
42
|
You've just got bit. When you `rake setup:development`, the mess gets
|
40
43
|
mad at you after it creates your database, and starts cranking through
|
41
44
|
migrations. It gets to the part where you iterate over the comments
|
42
|
-
and it blows up. You don't have a
|
45
|
+
and it blows up. You don't have a `Comment` model anymore for it to
|
43
46
|
even try and get 'all' from. You think you are smarter, and wrap the
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
ActiveRecord call in a conditional based on the environment.
|
48
|
+
|
49
|
+
That's fine until you get that QA gal, and she wants her own thing.
|
50
|
+
Then the UI people get tired of waiting for the full stack to load on page
|
51
|
+
refreshes, so you have to edit past migrations...
|
48
52
|
|
49
53
|
With Data Migrate, you have the control. You can generate your
|
50
54
|
migrations as schema or data as you would as your work flow. For
|
51
55
|
setting tasks that don't require any intermediate AR activity, like
|
52
|
-
dev and test, you stick with db:migrate
|
56
|
+
dev and test, you stick with `db:migrate`. For production and QA, you
|
53
57
|
change their scripts to `db:migrate:with_data`. Of course you want to
|
54
58
|
test your migration, so you have the choice of `db:migrate:with_data` or
|
55
59
|
`data:migrate` to just capture that data change.
|
56
60
|
|
57
|
-
## What
|
61
|
+
## What does it do?
|
58
62
|
|
59
63
|
Data migrations are stored in `db/data`. They act like schema
|
60
64
|
migrations, except they should be reserved for data migrations. For
|
@@ -71,7 +75,11 @@ Rails 4: Version 2.0 supports Rails 4.0 and higher
|
|
71
75
|
|
72
76
|
Rails 5.0: Supported
|
73
77
|
|
74
|
-
|
78
|
+
Rails 5.1: Supported
|
79
|
+
|
80
|
+
### Important notes for older versions
|
81
|
+
|
82
|
+
#### v2
|
75
83
|
|
76
84
|
If you upgraded to Rails 4 while using `data_migrate` prior to version 2,
|
77
85
|
the gem wrote data migration versions into
|
@@ -80,6 +88,11 @@ the gem wrote data migration versions into
|
|
80
88
|
|
81
89
|
This may cause some unintended consequences. See [#22](https://github.com/ilyakatz/data-migrate/issues/22)
|
82
90
|
|
91
|
+
#### v1
|
92
|
+
|
93
|
+
If you've installed previous to v1.1.0, you'll want to delete the
|
94
|
+
`create_data_migrations_table` migration.
|
95
|
+
|
83
96
|
## Installation
|
84
97
|
Add the gem to your project
|
85
98
|
|
@@ -89,10 +102,9 @@ Add the gem to your project
|
|
89
102
|
Then `bundle install` and you are ready to go.
|
90
103
|
|
91
104
|
So you know, when you use one of the provide rake tasks, a table
|
92
|
-
called
|
93
|
-
is to mirror the way the standard
|
94
|
-
|
95
|
-
'create\_data\_migrations_table' migration.
|
105
|
+
called `data_migrations` will be created in your database. This
|
106
|
+
is to mirror the way the standard `db` rake tasks work.
|
107
|
+
|
96
108
|
|
97
109
|
## Usage
|
98
110
|
|
@@ -147,6 +159,7 @@ From now on capistrano will run `rake db:migrate:with_data` in every deploy.
|
|
147
159
|
Run tests for a specific version of Rails
|
148
160
|
|
149
161
|
```
|
162
|
+
appraisal install
|
150
163
|
appraisal rails-4.2 rspec
|
151
164
|
appraisal rails-5.0 rspec
|
152
165
|
```
|
data/data_migrate.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = "data_migrate"
|
17
17
|
|
18
|
-
s.add_dependency('rails', '>= 4.0'
|
18
|
+
s.add_dependency('rails', '>= 4.0')
|
19
19
|
s.add_development_dependency "appraisal"
|
20
20
|
s.add_development_dependency "rake"
|
21
21
|
s.add_development_dependency "rspec"
|
data/lib/data_migrate/version.rb
CHANGED
data/screenshot.png
ADDED
Binary file
|
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: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew J Vargo
|
@@ -9,138 +9,132 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-06
|
12
|
+
date: 2017-08-06 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
|
-
- - <
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '5.1'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ">="
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '4.0'
|
31
|
-
- - <
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.1'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
29
|
name: appraisal
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
37
31
|
requirements:
|
38
|
-
- -
|
32
|
+
- - ">="
|
39
33
|
- !ruby/object:Gem::Version
|
40
34
|
version: '0'
|
41
35
|
type: :development
|
42
36
|
prerelease: false
|
43
37
|
version_requirements: !ruby/object:Gem::Requirement
|
44
38
|
requirements:
|
45
|
-
- -
|
39
|
+
- - ">="
|
46
40
|
- !ruby/object:Gem::Version
|
47
41
|
version: '0'
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
43
|
name: rake
|
50
44
|
requirement: !ruby/object:Gem::Requirement
|
51
45
|
requirements:
|
52
|
-
- -
|
46
|
+
- - ">="
|
53
47
|
- !ruby/object:Gem::Version
|
54
48
|
version: '0'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
52
|
requirements:
|
59
|
-
- -
|
53
|
+
- - ">="
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: '0'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: rspec
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
59
|
requirements:
|
66
|
-
- -
|
60
|
+
- - ">="
|
67
61
|
- !ruby/object:Gem::Version
|
68
62
|
version: '0'
|
69
63
|
type: :development
|
70
64
|
prerelease: false
|
71
65
|
version_requirements: !ruby/object:Gem::Requirement
|
72
66
|
requirements:
|
73
|
-
- -
|
67
|
+
- - ">="
|
74
68
|
- !ruby/object:Gem::Version
|
75
69
|
version: '0'
|
76
70
|
- !ruby/object:Gem::Dependency
|
77
71
|
name: rspec-core
|
78
72
|
requirement: !ruby/object:Gem::Requirement
|
79
73
|
requirements:
|
80
|
-
- -
|
74
|
+
- - ">="
|
81
75
|
- !ruby/object:Gem::Version
|
82
76
|
version: '0'
|
83
77
|
type: :development
|
84
78
|
prerelease: false
|
85
79
|
version_requirements: !ruby/object:Gem::Requirement
|
86
80
|
requirements:
|
87
|
-
- -
|
81
|
+
- - ">="
|
88
82
|
- !ruby/object:Gem::Version
|
89
83
|
version: '0'
|
90
84
|
- !ruby/object:Gem::Dependency
|
91
85
|
name: pry
|
92
86
|
requirement: !ruby/object:Gem::Requirement
|
93
87
|
requirements:
|
94
|
-
- -
|
88
|
+
- - ">="
|
95
89
|
- !ruby/object:Gem::Version
|
96
90
|
version: '0'
|
97
91
|
type: :development
|
98
92
|
prerelease: false
|
99
93
|
version_requirements: !ruby/object:Gem::Requirement
|
100
94
|
requirements:
|
101
|
-
- -
|
95
|
+
- - ">="
|
102
96
|
- !ruby/object:Gem::Version
|
103
97
|
version: '0'
|
104
98
|
- !ruby/object:Gem::Dependency
|
105
99
|
name: rb-readline
|
106
100
|
requirement: !ruby/object:Gem::Requirement
|
107
101
|
requirements:
|
108
|
-
- -
|
102
|
+
- - ">="
|
109
103
|
- !ruby/object:Gem::Version
|
110
104
|
version: '0'
|
111
105
|
type: :development
|
112
106
|
prerelease: false
|
113
107
|
version_requirements: !ruby/object:Gem::Requirement
|
114
108
|
requirements:
|
115
|
-
- -
|
109
|
+
- - ">="
|
116
110
|
- !ruby/object:Gem::Version
|
117
111
|
version: '0'
|
118
112
|
- !ruby/object:Gem::Dependency
|
119
113
|
name: sqlite3
|
120
114
|
requirement: !ruby/object:Gem::Requirement
|
121
115
|
requirements:
|
122
|
-
- -
|
116
|
+
- - ">="
|
123
117
|
- !ruby/object:Gem::Version
|
124
118
|
version: '0'
|
125
119
|
type: :development
|
126
120
|
prerelease: false
|
127
121
|
version_requirements: !ruby/object:Gem::Requirement
|
128
122
|
requirements:
|
129
|
-
- -
|
123
|
+
- - ">="
|
130
124
|
- !ruby/object:Gem::Version
|
131
125
|
version: '0'
|
132
126
|
- !ruby/object:Gem::Dependency
|
133
127
|
name: timecop
|
134
128
|
requirement: !ruby/object:Gem::Requirement
|
135
129
|
requirements:
|
136
|
-
- -
|
130
|
+
- - ">="
|
137
131
|
- !ruby/object:Gem::Version
|
138
132
|
version: '0'
|
139
133
|
type: :development
|
140
134
|
prerelease: false
|
141
135
|
version_requirements: !ruby/object:Gem::Requirement
|
142
136
|
requirements:
|
143
|
-
- -
|
137
|
+
- - ">="
|
144
138
|
- !ruby/object:Gem::Version
|
145
139
|
version: '0'
|
146
140
|
description: Rake tasks to migrate data alongside schema changes.
|
@@ -151,13 +145,14 @@ executables: []
|
|
151
145
|
extensions: []
|
152
146
|
extra_rdoc_files: []
|
153
147
|
files:
|
154
|
-
- .gitignore
|
155
|
-
- .rspec
|
156
|
-
- .travis.yml
|
148
|
+
- ".gitignore"
|
149
|
+
- ".rspec"
|
150
|
+
- ".travis.yml"
|
157
151
|
- Appraisals
|
158
152
|
- Changelog.md
|
159
153
|
- Gemfile
|
160
154
|
- Gemfile.rails5
|
155
|
+
- Gemfile.rails5.1
|
161
156
|
- LICENSE
|
162
157
|
- README.md
|
163
158
|
- Rakefile
|
@@ -166,6 +161,7 @@ files:
|
|
166
161
|
- gemfiles/rails_4.1.gemfile
|
167
162
|
- gemfiles/rails_4.2.gemfile
|
168
163
|
- gemfiles/rails_5.0.gemfile
|
164
|
+
- gemfiles/rails_5.1.gemfile
|
169
165
|
- lib/capistrano/data_migrate.rb
|
170
166
|
- lib/capistrano/data_migrate/migrate.rb
|
171
167
|
- lib/data_migrate.rb
|
@@ -179,10 +175,10 @@ files:
|
|
179
175
|
- lib/generators/data_migration/data_migration_generator.rb
|
180
176
|
- lib/generators/data_migration/templates/data_migration.rb
|
181
177
|
- lib/generators/data_migration/templates/migration.rb
|
178
|
+
- screenshot.png
|
182
179
|
- spec/data_migrate/data_migrator_spec.rb
|
183
180
|
- spec/data_migrate/data_schema_migration_spec.rb
|
184
181
|
- spec/data_migrate/migration.rb
|
185
|
-
- spec/db/test.db
|
186
182
|
- spec/generators/data_migration/data_migration_generator_spec.rb
|
187
183
|
- spec/spec_helper.rb
|
188
184
|
- tasks/.gitkeep
|
@@ -200,17 +196,17 @@ require_paths:
|
|
200
196
|
- lib
|
201
197
|
required_ruby_version: !ruby/object:Gem::Requirement
|
202
198
|
requirements:
|
203
|
-
- -
|
199
|
+
- - ">="
|
204
200
|
- !ruby/object:Gem::Version
|
205
201
|
version: '0'
|
206
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
203
|
requirements:
|
208
|
-
- -
|
204
|
+
- - ">="
|
209
205
|
- !ruby/object:Gem::Version
|
210
206
|
version: '0'
|
211
207
|
requirements: []
|
212
208
|
rubyforge_project: data_migrate
|
213
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.5.1
|
214
210
|
signing_key:
|
215
211
|
specification_version: 4
|
216
212
|
summary: Rake tasks to migrate data alongside schema changes.
|
@@ -218,6 +214,5 @@ test_files:
|
|
218
214
|
- spec/data_migrate/data_migrator_spec.rb
|
219
215
|
- spec/data_migrate/data_schema_migration_spec.rb
|
220
216
|
- spec/data_migrate/migration.rb
|
221
|
-
- spec/db/test.db
|
222
217
|
- spec/generators/data_migration/data_migration_generator_spec.rb
|
223
218
|
- spec/spec_helper.rb
|
data/spec/db/test.db
DELETED
Binary file
|