data_migrate 9.1.2 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +1 -1
- data/.gitignore +0 -1
- data/Appraisals +5 -5
- data/Changelog.md +3 -7
- data/Gemfile.lock +148 -0
- data/README.md +3 -3
- data/data_migrate.gemspec +1 -1
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_6.1.gemfile.lock +227 -0
- data/gemfiles/rails_7.0.gemfile +1 -1
- data/gemfiles/rails_7.0.gemfile.lock +229 -0
- data/gemfiles/{rails_6.0.gemfile → rails_7.1.gemfile} +1 -1
- data/gemfiles/rails_7.1.gemfile.lock +262 -0
- data/lib/data_migrate/data_migrator.rb +11 -23
- data/lib/data_migrate/data_schema.rb +1 -1
- data/lib/data_migrate/data_schema_migration.rb +24 -7
- data/lib/data_migrate/database_tasks.rb +6 -16
- data/lib/data_migrate/migration_context.rb +11 -8
- data/lib/data_migrate/rails_helper.rb +79 -0
- data/lib/data_migrate/schema_dumper.rb +1 -1
- data/lib/data_migrate/schema_migration.rb +5 -4
- data/lib/data_migrate/status_service.rb +3 -3
- data/lib/data_migrate/tasks/data_migrate_tasks.rb +3 -3
- data/lib/data_migrate/version.rb +1 -1
- data/lib/data_migrate.rb +1 -1
- data/spec/data_migrate/data_migrator_spec.rb +16 -13
- data/spec/data_migrate/data_schema_migration_spec.rb +25 -8
- data/spec/data_migrate/data_spec.rb +1 -1
- data/spec/data_migrate/database_tasks_spec.rb +34 -18
- data/spec/data_migrate/migration_context_spec.rb +15 -8
- data/spec/data_migrate/schema_dumper_spec.rb +6 -3
- data/spec/data_migrate/schema_migration_spec.rb +13 -6
- data/spec/data_migrate/status_service_spec.rb +6 -3
- data/spec/data_migrate/tasks/data_migrate_tasks_spec.rb +8 -8
- data/spec/db/data/20091231235959_some_name.rb +1 -1
- data/spec/db/data/20171231235959_super_update.rb +1 -1
- data/spec/db/migrate/20131111111111_late_migration.rb +1 -1
- data/spec/db/migrate/20202020202011_db_migration.rb +1 -1
- metadata +13 -10
- data/lib/data_migrate/legacy_migrator.rb +0 -22
- data/spec/data_migrate/legacy_migrator_spec.rb +0 -38
@@ -0,0 +1,229 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
data_migrate (9.2.0)
|
5
|
+
activerecord (>= 6.1)
|
6
|
+
railties (>= 6.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (7.0.6)
|
12
|
+
actionpack (= 7.0.6)
|
13
|
+
activesupport (= 7.0.6)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (7.0.6)
|
17
|
+
actionpack (= 7.0.6)
|
18
|
+
activejob (= 7.0.6)
|
19
|
+
activerecord (= 7.0.6)
|
20
|
+
activestorage (= 7.0.6)
|
21
|
+
activesupport (= 7.0.6)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.6)
|
27
|
+
actionpack (= 7.0.6)
|
28
|
+
actionview (= 7.0.6)
|
29
|
+
activejob (= 7.0.6)
|
30
|
+
activesupport (= 7.0.6)
|
31
|
+
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
35
|
+
rails-dom-testing (~> 2.0)
|
36
|
+
actionpack (7.0.6)
|
37
|
+
actionview (= 7.0.6)
|
38
|
+
activesupport (= 7.0.6)
|
39
|
+
rack (~> 2.0, >= 2.2.4)
|
40
|
+
rack-test (>= 0.6.3)
|
41
|
+
rails-dom-testing (~> 2.0)
|
42
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
43
|
+
actiontext (7.0.6)
|
44
|
+
actionpack (= 7.0.6)
|
45
|
+
activerecord (= 7.0.6)
|
46
|
+
activestorage (= 7.0.6)
|
47
|
+
activesupport (= 7.0.6)
|
48
|
+
globalid (>= 0.6.0)
|
49
|
+
nokogiri (>= 1.8.5)
|
50
|
+
actionview (7.0.6)
|
51
|
+
activesupport (= 7.0.6)
|
52
|
+
builder (~> 3.1)
|
53
|
+
erubi (~> 1.4)
|
54
|
+
rails-dom-testing (~> 2.0)
|
55
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
56
|
+
activejob (7.0.6)
|
57
|
+
activesupport (= 7.0.6)
|
58
|
+
globalid (>= 0.3.6)
|
59
|
+
activemodel (7.0.6)
|
60
|
+
activesupport (= 7.0.6)
|
61
|
+
activerecord (7.0.6)
|
62
|
+
activemodel (= 7.0.6)
|
63
|
+
activesupport (= 7.0.6)
|
64
|
+
activestorage (7.0.6)
|
65
|
+
actionpack (= 7.0.6)
|
66
|
+
activejob (= 7.0.6)
|
67
|
+
activerecord (= 7.0.6)
|
68
|
+
activesupport (= 7.0.6)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.6)
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
73
|
+
i18n (>= 1.6, < 2)
|
74
|
+
minitest (>= 5.1)
|
75
|
+
tzinfo (~> 2.0)
|
76
|
+
appraisal (2.4.1)
|
77
|
+
bundler
|
78
|
+
rake
|
79
|
+
thor (>= 0.14.0)
|
80
|
+
ast (2.4.2)
|
81
|
+
builder (3.2.4)
|
82
|
+
childprocess (4.1.0)
|
83
|
+
coderay (1.1.3)
|
84
|
+
concurrent-ruby (1.2.2)
|
85
|
+
crass (1.0.6)
|
86
|
+
date (3.3.3)
|
87
|
+
diff-lcs (1.5.0)
|
88
|
+
erubi (1.12.0)
|
89
|
+
globalid (1.1.0)
|
90
|
+
activesupport (>= 5.0)
|
91
|
+
i18n (1.14.1)
|
92
|
+
concurrent-ruby (~> 1.0)
|
93
|
+
iniparse (1.5.0)
|
94
|
+
json (2.6.3)
|
95
|
+
language_server-protocol (3.17.0.3)
|
96
|
+
loofah (2.21.3)
|
97
|
+
crass (~> 1.0.2)
|
98
|
+
nokogiri (>= 1.12.0)
|
99
|
+
mail (2.8.1)
|
100
|
+
mini_mime (>= 0.1.1)
|
101
|
+
net-imap
|
102
|
+
net-pop
|
103
|
+
net-smtp
|
104
|
+
marcel (1.0.2)
|
105
|
+
method_source (1.0.0)
|
106
|
+
mini_mime (1.1.2)
|
107
|
+
minitest (5.18.1)
|
108
|
+
net-imap (0.3.6)
|
109
|
+
date
|
110
|
+
net-protocol
|
111
|
+
net-pop (0.1.2)
|
112
|
+
net-protocol
|
113
|
+
net-protocol (0.2.1)
|
114
|
+
timeout
|
115
|
+
net-smtp (0.3.3)
|
116
|
+
net-protocol
|
117
|
+
nio4r (2.5.9)
|
118
|
+
nokogiri (1.15.3-arm64-darwin)
|
119
|
+
racc (~> 1.4)
|
120
|
+
nokogiri (1.15.3-x86_64-linux)
|
121
|
+
racc (~> 1.4)
|
122
|
+
overcommit (0.60.0)
|
123
|
+
childprocess (>= 0.6.3, < 5)
|
124
|
+
iniparse (~> 1.4)
|
125
|
+
rexml (~> 3.2)
|
126
|
+
parallel (1.23.0)
|
127
|
+
parser (3.2.2.3)
|
128
|
+
ast (~> 2.4.1)
|
129
|
+
racc
|
130
|
+
pry (0.14.2)
|
131
|
+
coderay (~> 1.1)
|
132
|
+
method_source (~> 1.0)
|
133
|
+
racc (1.7.1)
|
134
|
+
rack (2.2.7)
|
135
|
+
rack-test (2.1.0)
|
136
|
+
rack (>= 1.3)
|
137
|
+
rails (7.0.6)
|
138
|
+
actioncable (= 7.0.6)
|
139
|
+
actionmailbox (= 7.0.6)
|
140
|
+
actionmailer (= 7.0.6)
|
141
|
+
actionpack (= 7.0.6)
|
142
|
+
actiontext (= 7.0.6)
|
143
|
+
actionview (= 7.0.6)
|
144
|
+
activejob (= 7.0.6)
|
145
|
+
activemodel (= 7.0.6)
|
146
|
+
activerecord (= 7.0.6)
|
147
|
+
activestorage (= 7.0.6)
|
148
|
+
activesupport (= 7.0.6)
|
149
|
+
bundler (>= 1.15.0)
|
150
|
+
railties (= 7.0.6)
|
151
|
+
rails-dom-testing (2.1.1)
|
152
|
+
activesupport (>= 5.0.0)
|
153
|
+
minitest
|
154
|
+
nokogiri (>= 1.6)
|
155
|
+
rails-html-sanitizer (1.6.0)
|
156
|
+
loofah (~> 2.21)
|
157
|
+
nokogiri (~> 1.14)
|
158
|
+
railties (7.0.6)
|
159
|
+
actionpack (= 7.0.6)
|
160
|
+
activesupport (= 7.0.6)
|
161
|
+
method_source
|
162
|
+
rake (>= 12.2)
|
163
|
+
thor (~> 1.0)
|
164
|
+
zeitwerk (~> 2.5)
|
165
|
+
rainbow (3.1.1)
|
166
|
+
rake (13.0.6)
|
167
|
+
rb-readline (0.5.5)
|
168
|
+
regexp_parser (2.8.1)
|
169
|
+
rexml (3.2.5)
|
170
|
+
rspec (3.12.0)
|
171
|
+
rspec-core (~> 3.12.0)
|
172
|
+
rspec-expectations (~> 3.12.0)
|
173
|
+
rspec-mocks (~> 3.12.0)
|
174
|
+
rspec-core (3.12.2)
|
175
|
+
rspec-support (~> 3.12.0)
|
176
|
+
rspec-expectations (3.12.3)
|
177
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
178
|
+
rspec-support (~> 3.12.0)
|
179
|
+
rspec-mocks (3.12.5)
|
180
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
181
|
+
rspec-support (~> 3.12.0)
|
182
|
+
rspec-support (3.12.1)
|
183
|
+
rubocop (1.54.1)
|
184
|
+
json (~> 2.3)
|
185
|
+
language_server-protocol (>= 3.17.0)
|
186
|
+
parallel (~> 1.10)
|
187
|
+
parser (>= 3.2.2.3)
|
188
|
+
rainbow (>= 2.2.2, < 4.0)
|
189
|
+
regexp_parser (>= 1.8, < 3.0)
|
190
|
+
rexml (>= 3.2.5, < 4.0)
|
191
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
192
|
+
ruby-progressbar (~> 1.7)
|
193
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
194
|
+
rubocop-ast (1.29.0)
|
195
|
+
parser (>= 3.2.1.0)
|
196
|
+
ruby-progressbar (1.13.0)
|
197
|
+
sqlite3 (1.6.3-arm64-darwin)
|
198
|
+
sqlite3 (1.6.3-x86_64-linux)
|
199
|
+
thor (1.2.2)
|
200
|
+
timecop (0.9.6)
|
201
|
+
timeout (0.4.0)
|
202
|
+
tzinfo (2.0.6)
|
203
|
+
concurrent-ruby (~> 1.0)
|
204
|
+
unicode-display_width (2.4.2)
|
205
|
+
websocket-driver (0.7.5)
|
206
|
+
websocket-extensions (>= 0.1.0)
|
207
|
+
websocket-extensions (0.1.5)
|
208
|
+
zeitwerk (2.6.8)
|
209
|
+
|
210
|
+
PLATFORMS
|
211
|
+
arm64-darwin-22
|
212
|
+
x86_64-linux
|
213
|
+
|
214
|
+
DEPENDENCIES
|
215
|
+
appraisal
|
216
|
+
data_migrate!
|
217
|
+
overcommit
|
218
|
+
pry
|
219
|
+
rails (~> 7.0)
|
220
|
+
rake
|
221
|
+
rb-readline
|
222
|
+
rspec
|
223
|
+
rspec-core
|
224
|
+
rubocop
|
225
|
+
sqlite3 (~> 1.4)
|
226
|
+
timecop
|
227
|
+
|
228
|
+
BUNDLED WITH
|
229
|
+
2.4.14
|
@@ -0,0 +1,262 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
data_migrate (9.2.0)
|
5
|
+
activerecord (>= 6.1)
|
6
|
+
railties (>= 6.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actioncable (7.1.0)
|
12
|
+
actionpack (= 7.1.0)
|
13
|
+
activesupport (= 7.1.0)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
zeitwerk (~> 2.6)
|
17
|
+
actionmailbox (7.1.0)
|
18
|
+
actionpack (= 7.1.0)
|
19
|
+
activejob (= 7.1.0)
|
20
|
+
activerecord (= 7.1.0)
|
21
|
+
activestorage (= 7.1.0)
|
22
|
+
activesupport (= 7.1.0)
|
23
|
+
mail (>= 2.7.1)
|
24
|
+
net-imap
|
25
|
+
net-pop
|
26
|
+
net-smtp
|
27
|
+
actionmailer (7.1.0)
|
28
|
+
actionpack (= 7.1.0)
|
29
|
+
actionview (= 7.1.0)
|
30
|
+
activejob (= 7.1.0)
|
31
|
+
activesupport (= 7.1.0)
|
32
|
+
mail (~> 2.5, >= 2.5.4)
|
33
|
+
net-imap
|
34
|
+
net-pop
|
35
|
+
net-smtp
|
36
|
+
rails-dom-testing (~> 2.2)
|
37
|
+
actionpack (7.1.0)
|
38
|
+
actionview (= 7.1.0)
|
39
|
+
activesupport (= 7.1.0)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
rack (>= 2.2.4)
|
42
|
+
rack-session (>= 1.0.1)
|
43
|
+
rack-test (>= 0.6.3)
|
44
|
+
rails-dom-testing (~> 2.2)
|
45
|
+
rails-html-sanitizer (~> 1.6)
|
46
|
+
actiontext (7.1.0)
|
47
|
+
actionpack (= 7.1.0)
|
48
|
+
activerecord (= 7.1.0)
|
49
|
+
activestorage (= 7.1.0)
|
50
|
+
activesupport (= 7.1.0)
|
51
|
+
globalid (>= 0.6.0)
|
52
|
+
nokogiri (>= 1.8.5)
|
53
|
+
actionview (7.1.0)
|
54
|
+
activesupport (= 7.1.0)
|
55
|
+
builder (~> 3.1)
|
56
|
+
erubi (~> 1.11)
|
57
|
+
rails-dom-testing (~> 2.2)
|
58
|
+
rails-html-sanitizer (~> 1.6)
|
59
|
+
activejob (7.1.0)
|
60
|
+
activesupport (= 7.1.0)
|
61
|
+
globalid (>= 0.3.6)
|
62
|
+
activemodel (7.1.0)
|
63
|
+
activesupport (= 7.1.0)
|
64
|
+
activerecord (7.1.0)
|
65
|
+
activemodel (= 7.1.0)
|
66
|
+
activesupport (= 7.1.0)
|
67
|
+
timeout (>= 0.4.0)
|
68
|
+
activestorage (7.1.0)
|
69
|
+
actionpack (= 7.1.0)
|
70
|
+
activejob (= 7.1.0)
|
71
|
+
activerecord (= 7.1.0)
|
72
|
+
activesupport (= 7.1.0)
|
73
|
+
marcel (~> 1.0)
|
74
|
+
activesupport (7.1.0)
|
75
|
+
base64
|
76
|
+
bigdecimal
|
77
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
78
|
+
connection_pool (>= 2.2.5)
|
79
|
+
drb
|
80
|
+
i18n (>= 1.6, < 2)
|
81
|
+
minitest (>= 5.1)
|
82
|
+
mutex_m
|
83
|
+
tzinfo (~> 2.0)
|
84
|
+
appraisal (2.5.0)
|
85
|
+
bundler
|
86
|
+
rake
|
87
|
+
thor (>= 0.14.0)
|
88
|
+
ast (2.4.2)
|
89
|
+
base64 (0.1.1)
|
90
|
+
bigdecimal (3.1.4)
|
91
|
+
builder (3.2.4)
|
92
|
+
childprocess (4.1.0)
|
93
|
+
coderay (1.1.3)
|
94
|
+
concurrent-ruby (1.2.2)
|
95
|
+
connection_pool (2.4.1)
|
96
|
+
crass (1.0.6)
|
97
|
+
date (3.3.3)
|
98
|
+
diff-lcs (1.5.0)
|
99
|
+
drb (2.1.1)
|
100
|
+
ruby2_keywords
|
101
|
+
erubi (1.12.0)
|
102
|
+
globalid (1.2.1)
|
103
|
+
activesupport (>= 6.1)
|
104
|
+
i18n (1.14.1)
|
105
|
+
concurrent-ruby (~> 1.0)
|
106
|
+
iniparse (1.5.0)
|
107
|
+
io-console (0.6.0)
|
108
|
+
irb (1.8.1)
|
109
|
+
rdoc
|
110
|
+
reline (>= 0.3.8)
|
111
|
+
json (2.6.3)
|
112
|
+
language_server-protocol (3.17.0.3)
|
113
|
+
loofah (2.21.3)
|
114
|
+
crass (~> 1.0.2)
|
115
|
+
nokogiri (>= 1.12.0)
|
116
|
+
mail (2.8.1)
|
117
|
+
mini_mime (>= 0.1.1)
|
118
|
+
net-imap
|
119
|
+
net-pop
|
120
|
+
net-smtp
|
121
|
+
marcel (1.0.2)
|
122
|
+
method_source (1.0.0)
|
123
|
+
mini_mime (1.1.5)
|
124
|
+
minitest (5.20.0)
|
125
|
+
mutex_m (0.1.2)
|
126
|
+
net-imap (0.4.0)
|
127
|
+
date
|
128
|
+
net-protocol
|
129
|
+
net-pop (0.1.2)
|
130
|
+
net-protocol
|
131
|
+
net-protocol (0.2.1)
|
132
|
+
timeout
|
133
|
+
net-smtp (0.4.0)
|
134
|
+
net-protocol
|
135
|
+
nio4r (2.5.9)
|
136
|
+
nokogiri (1.15.4-arm64-darwin)
|
137
|
+
racc (~> 1.4)
|
138
|
+
nokogiri (1.15.4-x86_64-linux)
|
139
|
+
racc (~> 1.4)
|
140
|
+
overcommit (0.60.0)
|
141
|
+
childprocess (>= 0.6.3, < 5)
|
142
|
+
iniparse (~> 1.4)
|
143
|
+
rexml (~> 3.2)
|
144
|
+
parallel (1.23.0)
|
145
|
+
parser (3.2.2.3)
|
146
|
+
ast (~> 2.4.1)
|
147
|
+
racc
|
148
|
+
pry (0.14.2)
|
149
|
+
coderay (~> 1.1)
|
150
|
+
method_source (~> 1.0)
|
151
|
+
psych (5.1.0)
|
152
|
+
stringio
|
153
|
+
racc (1.7.1)
|
154
|
+
rack (3.0.8)
|
155
|
+
rack-session (2.0.0)
|
156
|
+
rack (>= 3.0.0)
|
157
|
+
rack-test (2.1.0)
|
158
|
+
rack (>= 1.3)
|
159
|
+
rackup (2.1.0)
|
160
|
+
rack (>= 3)
|
161
|
+
webrick (~> 1.8)
|
162
|
+
rails (7.1.0)
|
163
|
+
actioncable (= 7.1.0)
|
164
|
+
actionmailbox (= 7.1.0)
|
165
|
+
actionmailer (= 7.1.0)
|
166
|
+
actionpack (= 7.1.0)
|
167
|
+
actiontext (= 7.1.0)
|
168
|
+
actionview (= 7.1.0)
|
169
|
+
activejob (= 7.1.0)
|
170
|
+
activemodel (= 7.1.0)
|
171
|
+
activerecord (= 7.1.0)
|
172
|
+
activestorage (= 7.1.0)
|
173
|
+
activesupport (= 7.1.0)
|
174
|
+
bundler (>= 1.15.0)
|
175
|
+
railties (= 7.1.0)
|
176
|
+
rails-dom-testing (2.2.0)
|
177
|
+
activesupport (>= 5.0.0)
|
178
|
+
minitest
|
179
|
+
nokogiri (>= 1.6)
|
180
|
+
rails-html-sanitizer (1.6.0)
|
181
|
+
loofah (~> 2.21)
|
182
|
+
nokogiri (~> 1.14)
|
183
|
+
railties (7.1.0)
|
184
|
+
actionpack (= 7.1.0)
|
185
|
+
activesupport (= 7.1.0)
|
186
|
+
irb
|
187
|
+
rackup (>= 1.0.0)
|
188
|
+
rake (>= 12.2)
|
189
|
+
thor (~> 1.0, >= 1.2.2)
|
190
|
+
zeitwerk (~> 2.6)
|
191
|
+
rainbow (3.1.1)
|
192
|
+
rake (13.0.6)
|
193
|
+
rb-readline (0.5.5)
|
194
|
+
rdoc (6.5.0)
|
195
|
+
psych (>= 4.0.0)
|
196
|
+
regexp_parser (2.8.1)
|
197
|
+
reline (0.3.9)
|
198
|
+
io-console (~> 0.5)
|
199
|
+
rexml (3.2.5)
|
200
|
+
rspec (3.12.0)
|
201
|
+
rspec-core (~> 3.12.0)
|
202
|
+
rspec-expectations (~> 3.12.0)
|
203
|
+
rspec-mocks (~> 3.12.0)
|
204
|
+
rspec-core (3.12.2)
|
205
|
+
rspec-support (~> 3.12.0)
|
206
|
+
rspec-expectations (3.12.3)
|
207
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
208
|
+
rspec-support (~> 3.12.0)
|
209
|
+
rspec-mocks (3.12.6)
|
210
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
211
|
+
rspec-support (~> 3.12.0)
|
212
|
+
rspec-support (3.12.1)
|
213
|
+
rubocop (1.54.2)
|
214
|
+
json (~> 2.3)
|
215
|
+
language_server-protocol (>= 3.17.0)
|
216
|
+
parallel (~> 1.10)
|
217
|
+
parser (>= 3.2.2.3)
|
218
|
+
rainbow (>= 2.2.2, < 4.0)
|
219
|
+
regexp_parser (>= 1.8, < 3.0)
|
220
|
+
rexml (>= 3.2.5, < 4.0)
|
221
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
222
|
+
ruby-progressbar (~> 1.7)
|
223
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
224
|
+
rubocop-ast (1.29.0)
|
225
|
+
parser (>= 3.2.1.0)
|
226
|
+
ruby-progressbar (1.13.0)
|
227
|
+
ruby2_keywords (0.0.5)
|
228
|
+
sqlite3 (1.6.3-arm64-darwin)
|
229
|
+
sqlite3 (1.6.3-x86_64-linux)
|
230
|
+
stringio (3.0.8)
|
231
|
+
thor (1.2.2)
|
232
|
+
timecop (0.9.6)
|
233
|
+
timeout (0.4.0)
|
234
|
+
tzinfo (2.0.6)
|
235
|
+
concurrent-ruby (~> 1.0)
|
236
|
+
unicode-display_width (2.4.2)
|
237
|
+
webrick (1.8.1)
|
238
|
+
websocket-driver (0.7.6)
|
239
|
+
websocket-extensions (>= 0.1.0)
|
240
|
+
websocket-extensions (0.1.5)
|
241
|
+
zeitwerk (2.6.12)
|
242
|
+
|
243
|
+
PLATFORMS
|
244
|
+
arm64-darwin-22
|
245
|
+
x86_64-linux
|
246
|
+
|
247
|
+
DEPENDENCIES
|
248
|
+
appraisal
|
249
|
+
data_migrate!
|
250
|
+
overcommit
|
251
|
+
pry
|
252
|
+
rails (= 7.1.0)
|
253
|
+
rake
|
254
|
+
rb-readline
|
255
|
+
rspec
|
256
|
+
rspec-core
|
257
|
+
rubocop
|
258
|
+
sqlite3 (~> 1.4)
|
259
|
+
timecop
|
260
|
+
|
261
|
+
BUNDLED WITH
|
262
|
+
2.4.17
|
@@ -5,32 +5,20 @@ require "data_migrate/config"
|
|
5
5
|
|
6
6
|
module DataMigrate
|
7
7
|
class DataMigrator < ActiveRecord::Migrator
|
8
|
-
def self.migrations_paths
|
9
|
-
[DataMigrate.config.data_migrations_path]
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.create_data_schema_table
|
13
|
-
DataMigrate::DataSchemaMigration.create_table
|
14
|
-
end
|
15
|
-
|
16
|
-
def initialize(direction, migrations, target_version = nil)
|
17
|
-
@direction = direction
|
18
|
-
@target_version = target_version
|
19
|
-
@migrated_versions = nil
|
20
|
-
@migrations = migrations
|
21
|
-
|
22
|
-
validate(@migrations)
|
23
|
-
|
24
|
-
DataMigrate::DataSchemaMigration.create_table
|
25
|
-
ActiveRecord::InternalMetadata.create_table
|
26
|
-
end
|
27
|
-
|
28
8
|
def load_migrated
|
29
9
|
@migrated_versions =
|
30
|
-
DataMigrate::
|
10
|
+
DataMigrate::RailsHelper.data_schema_migration.normalized_versions.map(&:to_i).sort
|
31
11
|
end
|
32
12
|
|
33
13
|
class << self
|
14
|
+
def migrations_paths
|
15
|
+
[DataMigrate.config.data_migrations_path]
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_data_schema_table
|
19
|
+
DataMigrate::RailsHelper.data_schema_migration.create_table
|
20
|
+
end
|
21
|
+
|
34
22
|
def current_version
|
35
23
|
DataMigrate::MigrationContext.new(migrations_paths).current_version
|
36
24
|
end
|
@@ -79,10 +67,10 @@ module DataMigrate
|
|
79
67
|
def record_version_state_after_migrating(version)
|
80
68
|
if down?
|
81
69
|
migrated.delete(version)
|
82
|
-
DataMigrate::
|
70
|
+
DataMigrate::RailsHelper.data_schema_delete_version(version.to_s)
|
83
71
|
else
|
84
72
|
migrated << version
|
85
|
-
DataMigrate::
|
73
|
+
DataMigrate::RailsHelper.data_schema_migration.create_version(version.to_s)
|
86
74
|
end
|
87
75
|
end
|
88
76
|
end
|
@@ -1,12 +1,29 @@
|
|
1
1
|
module DataMigrate
|
2
|
-
class DataSchemaMigration
|
3
|
-
|
4
|
-
|
2
|
+
class DataSchemaMigration < ActiveRecord::SchemaMigration
|
3
|
+
# In Rails 7.1+, ActiveRecord::SchemaMigration methods are instance methods
|
4
|
+
# So we only load the appropriate methods depending on Rails version.
|
5
|
+
if DataMigrate::RailsHelper.rails_version_equal_to_or_higher_than_7_1
|
6
|
+
def table_name
|
7
|
+
ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix
|
8
|
+
end
|
9
|
+
|
10
|
+
def primary_key
|
11
|
+
"version"
|
12
|
+
end
|
13
|
+
else
|
14
|
+
class << self
|
15
|
+
def table_name
|
16
|
+
ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix
|
17
|
+
end
|
18
|
+
|
19
|
+
def primary_key
|
20
|
+
"version"
|
21
|
+
end
|
5
22
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
23
|
+
def create_version(version)
|
24
|
+
# Note that SchemaMigration.create_version in Rails 7.1 does not
|
25
|
+
# raise an error if validations fail but we retain this behaviour for now.
|
26
|
+
create!(version: version)
|
10
27
|
end
|
11
28
|
end
|
12
29
|
end
|
@@ -74,10 +74,6 @@ module DataMigrate
|
|
74
74
|
# We only require a schema.rb file for the primary database
|
75
75
|
return unless db_config.primary?
|
76
76
|
|
77
|
-
if rails_version_lower_than_6_1?
|
78
|
-
return super.gsub(/(_)?schema\.rb\z/, '\1data_schema.rb')
|
79
|
-
end
|
80
|
-
|
81
77
|
File.join(File.dirname(ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(db_config, format)), schema_file_type)
|
82
78
|
end
|
83
79
|
|
@@ -85,10 +81,6 @@ module DataMigrate
|
|
85
81
|
# to ensure that the sha saved in ar_internal_metadata table
|
86
82
|
# is from the original schema.rb file
|
87
83
|
def schema_sha1(file)
|
88
|
-
if rails_version_lower_than_6_1?
|
89
|
-
return super(file.gsub(/data_schema.rb\z/, 'schema.rb'))
|
90
|
-
end
|
91
|
-
|
92
84
|
ActiveRecord::Tasks::DatabaseTasks.schema_dump_path(ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env, name: "primary"))
|
93
85
|
end
|
94
86
|
end
|
@@ -109,8 +101,10 @@ module DataMigrate
|
|
109
101
|
|
110
102
|
def self.pending_data_migrations
|
111
103
|
data_migrations = DataMigrate::DataMigrator.migrations(data_migrations_path)
|
112
|
-
|
113
|
-
|
104
|
+
data_migrator = DataMigrate::RailsHelper.data_migrator(:up, data_migrations)
|
105
|
+
sort_migrations(
|
106
|
+
data_migrator.pending_migrations.map { |m| { version: m.version, name: m.name, kind: :data } }
|
107
|
+
)
|
114
108
|
end
|
115
109
|
|
116
110
|
def self.pending_schema_migrations
|
@@ -118,15 +112,11 @@ module DataMigrate
|
|
118
112
|
end
|
119
113
|
|
120
114
|
def self.past_migrations(sort = nil)
|
121
|
-
data_versions = DataMigrate::
|
122
|
-
schema_versions =
|
115
|
+
data_versions = DataMigrate::RailsHelper.data_schema_migration.table_exists? ? DataMigrate::RailsHelper.data_schema_migration.normalized_versions : []
|
116
|
+
schema_versions = DataMigrate::RailsHelper.schema_migration.normalized_versions
|
123
117
|
migrations = data_versions.map { |v| { version: v.to_i, kind: :data } } + schema_versions.map { |v| { version: v.to_i, kind: :schema } }
|
124
118
|
|
125
119
|
sort&.downcase == "asc" ? sort_migrations(migrations) : sort_migrations(migrations).reverse
|
126
120
|
end
|
127
|
-
|
128
|
-
def self.rails_version_lower_than_6_1?
|
129
|
-
Gem::Dependency.new("railties", "< 6.1").match?("railties", Gem.loaded_specs["railties"].version)
|
130
|
-
end
|
131
121
|
end
|
132
122
|
end
|