data_migrate 9.4.0 → 9.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +3 -0
- data/Gemfile.lock +27 -27
- data/gemfiles/rails_6.1.gemfile.lock +1 -1
- data/gemfiles/rails_7.0.gemfile.lock +1 -1
- data/gemfiles/rails_7.1.gemfile.lock +1 -1
- data/lib/data_migrate/database_tasks.rb +31 -0
- data/lib/data_migrate/version.rb +1 -1
- data/tasks/databases.rake +1 -28
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa16e421f2f5d046c5e78678b226574ddaeca7345bfcff5f8ab69091fb901f3c
|
4
|
+
data.tar.gz: 91d60c54724dc47e6aac6f7638275c005c0f27f052741c00fbed0f15fb8056b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0585dd9cc369cfbb980c609d1c7f1cc286a3109f799303d1518cca460f1e41b89df484154426e8e6798cd674f520241d19ab4bd2343bb0800e429de78b7d379
|
7
|
+
data.tar.gz: 52aeb1ce48bcf2644f8c4640b99d5dbb98bee62e10fa5f3a20fabff41eb3dc833c346c39b51245a128095eb75231d588ca734092056aedbff62bfa1df6512888
|
data/Changelog.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 9.4.1
|
4
|
+
- Add db:prepare task
|
5
|
+
|
3
6
|
## 9.4.0
|
4
7
|
- Reset model schema cache before each data migration https://github.com/ilyakatz/data-migrate/pull/307
|
5
8
|
- Run load_config rake task before db:migrate:with_data https://github.com/ilyakatz/data-migrate/pull/308
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
data_migrate (9.4.
|
4
|
+
data_migrate (9.4.1)
|
5
5
|
activerecord (>= 6.1)
|
6
6
|
railties (>= 6.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (7.1.3.
|
12
|
-
actionview (= 7.1.3.
|
13
|
-
activesupport (= 7.1.3.
|
11
|
+
actionpack (7.1.3.4)
|
12
|
+
actionview (= 7.1.3.4)
|
13
|
+
activesupport (= 7.1.3.4)
|
14
14
|
nokogiri (>= 1.8.5)
|
15
15
|
racc
|
16
16
|
rack (>= 2.2.4)
|
@@ -18,19 +18,19 @@ GEM
|
|
18
18
|
rack-test (>= 0.6.3)
|
19
19
|
rails-dom-testing (~> 2.2)
|
20
20
|
rails-html-sanitizer (~> 1.6)
|
21
|
-
actionview (7.1.3.
|
22
|
-
activesupport (= 7.1.3.
|
21
|
+
actionview (7.1.3.4)
|
22
|
+
activesupport (= 7.1.3.4)
|
23
23
|
builder (~> 3.1)
|
24
24
|
erubi (~> 1.11)
|
25
25
|
rails-dom-testing (~> 2.2)
|
26
26
|
rails-html-sanitizer (~> 1.6)
|
27
|
-
activemodel (7.1.3.
|
28
|
-
activesupport (= 7.1.3.
|
29
|
-
activerecord (7.1.3.
|
30
|
-
activemodel (= 7.1.3.
|
31
|
-
activesupport (= 7.1.3.
|
27
|
+
activemodel (7.1.3.4)
|
28
|
+
activesupport (= 7.1.3.4)
|
29
|
+
activerecord (7.1.3.4)
|
30
|
+
activemodel (= 7.1.3.4)
|
31
|
+
activesupport (= 7.1.3.4)
|
32
32
|
timeout (>= 0.4.0)
|
33
|
-
activesupport (7.1.3.
|
33
|
+
activesupport (7.1.3.4)
|
34
34
|
base64
|
35
35
|
bigdecimal
|
36
36
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -46,18 +46,17 @@ GEM
|
|
46
46
|
thor (>= 0.14.0)
|
47
47
|
ast (2.4.2)
|
48
48
|
base64 (0.2.0)
|
49
|
-
bigdecimal (3.1.
|
49
|
+
bigdecimal (3.1.8)
|
50
50
|
builder (3.2.4)
|
51
51
|
childprocess (5.0.0)
|
52
52
|
coderay (1.1.3)
|
53
|
-
concurrent-ruby (1.
|
53
|
+
concurrent-ruby (1.3.1)
|
54
54
|
connection_pool (2.4.1)
|
55
55
|
crass (1.0.6)
|
56
56
|
diff-lcs (1.5.1)
|
57
|
-
drb (2.2.
|
58
|
-
ruby2_keywords
|
57
|
+
drb (2.2.1)
|
59
58
|
erubi (1.12.0)
|
60
|
-
i18n (1.14.
|
59
|
+
i18n (1.14.5)
|
61
60
|
concurrent-ruby (~> 1.0)
|
62
61
|
iniparse (1.5.0)
|
63
62
|
io-console (0.7.2)
|
@@ -70,11 +69,11 @@ GEM
|
|
70
69
|
crass (~> 1.0.2)
|
71
70
|
nokogiri (>= 1.12.0)
|
72
71
|
method_source (1.0.0)
|
73
|
-
minitest (5.
|
72
|
+
minitest (5.23.1)
|
74
73
|
mutex_m (0.2.0)
|
75
|
-
nokogiri (1.16.
|
74
|
+
nokogiri (1.16.5-arm64-darwin)
|
76
75
|
racc (~> 1.4)
|
77
|
-
nokogiri (1.16.
|
76
|
+
nokogiri (1.16.5-x86_64-linux)
|
78
77
|
racc (~> 1.4)
|
79
78
|
overcommit (0.63.0)
|
80
79
|
childprocess (>= 0.6.3, < 6)
|
@@ -89,8 +88,8 @@ GEM
|
|
89
88
|
method_source (~> 1.0)
|
90
89
|
psych (5.1.2)
|
91
90
|
stringio
|
92
|
-
racc (1.
|
93
|
-
rack (3.0.
|
91
|
+
racc (1.8.0)
|
92
|
+
rack (3.0.11)
|
94
93
|
rack-session (2.0.0)
|
95
94
|
rack (>= 3.0.0)
|
96
95
|
rack-test (2.1.0)
|
@@ -105,9 +104,9 @@ GEM
|
|
105
104
|
rails-html-sanitizer (1.6.0)
|
106
105
|
loofah (~> 2.21)
|
107
106
|
nokogiri (~> 1.14)
|
108
|
-
railties (7.1.3.
|
109
|
-
actionpack (= 7.1.3.
|
110
|
-
activesupport (= 7.1.3.
|
107
|
+
railties (7.1.3.4)
|
108
|
+
actionpack (= 7.1.3.4)
|
109
|
+
activesupport (= 7.1.3.4)
|
111
110
|
irb
|
112
111
|
rackup (>= 1.0.0)
|
113
112
|
rake (>= 12.2)
|
@@ -121,7 +120,8 @@ GEM
|
|
121
120
|
regexp_parser (2.9.0)
|
122
121
|
reline (0.4.3)
|
123
122
|
io-console (~> 0.5)
|
124
|
-
rexml (3.2.
|
123
|
+
rexml (3.2.8)
|
124
|
+
strscan (>= 3.0.9)
|
125
125
|
rspec (3.13.0)
|
126
126
|
rspec-core (~> 3.13.0)
|
127
127
|
rspec-expectations (~> 3.13.0)
|
@@ -149,10 +149,10 @@ GEM
|
|
149
149
|
rubocop-ast (1.30.0)
|
150
150
|
parser (>= 3.2.1.0)
|
151
151
|
ruby-progressbar (1.13.0)
|
152
|
-
ruby2_keywords (0.0.5)
|
153
152
|
sqlite3 (1.7.2-arm64-darwin)
|
154
153
|
sqlite3 (1.7.2-x86_64-linux)
|
155
154
|
stringio (3.1.0)
|
155
|
+
strscan (3.1.0)
|
156
156
|
thor (1.3.1)
|
157
157
|
timecop (0.9.8)
|
158
158
|
timeout (0.4.1)
|
@@ -173,5 +173,36 @@ module DataMigrate
|
|
173
173
|
|
174
174
|
sort&.downcase == "asc" ? sort_migrations(migrations) : sort_migrations(migrations).reverse
|
175
175
|
end
|
176
|
+
|
177
|
+
def self.migrate_with_data
|
178
|
+
DataMigrate::DataMigrator.create_data_schema_table
|
179
|
+
|
180
|
+
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
181
|
+
|
182
|
+
db_configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env)
|
183
|
+
|
184
|
+
schema_mapped_versions = ActiveRecord::Tasks::DatabaseTasks.db_configs_with_versions(db_configs)
|
185
|
+
data_mapped_versions = DataMigrate::DatabaseTasks.db_configs_with_versions
|
186
|
+
|
187
|
+
mapped_versions = schema_mapped_versions.merge(data_mapped_versions) do |_key, schema_db_configs, data_db_configs|
|
188
|
+
schema_db_configs + data_db_configs
|
189
|
+
end
|
190
|
+
|
191
|
+
mapped_versions.sort.each do |version, db_configs|
|
192
|
+
db_configs.each do |db_config|
|
193
|
+
if is_data_migration = db_config.is_a?(DataMigrate::DatabaseConfigurationWrapper)
|
194
|
+
db_config = db_config.db_config
|
195
|
+
end
|
196
|
+
|
197
|
+
DataMigrate::DatabaseTasks.with_temporary_connection(db_config) do
|
198
|
+
if is_data_migration
|
199
|
+
DataMigrate::DataMigrator.run(:up, DataMigrate::DatabaseTasks.data_migrations_path, version)
|
200
|
+
else
|
201
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate(version)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
176
207
|
end
|
177
208
|
end
|
data/lib/data_migrate/version.rb
CHANGED
data/tasks/databases.rake
CHANGED
@@ -6,34 +6,7 @@ namespace :db do
|
|
6
6
|
namespace :migrate do
|
7
7
|
desc "Migrate the database data and schema (options: VERSION=x, VERBOSE=false)."
|
8
8
|
task :with_data => :load_config do
|
9
|
-
DataMigrate::
|
10
|
-
ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
11
|
-
|
12
|
-
db_configs = ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env)
|
13
|
-
|
14
|
-
schema_mapped_versions = ActiveRecord::Tasks::DatabaseTasks.db_configs_with_versions(db_configs)
|
15
|
-
data_mapped_versions = DataMigrate::DatabaseTasks.db_configs_with_versions
|
16
|
-
|
17
|
-
mapped_versions = schema_mapped_versions.merge(data_mapped_versions) do |_key, schema_db_configs, data_db_configs|
|
18
|
-
schema_db_configs + data_db_configs
|
19
|
-
end
|
20
|
-
|
21
|
-
mapped_versions.sort.each do |version, db_configs|
|
22
|
-
db_configs.each do |db_config|
|
23
|
-
if is_data_migration = db_config.is_a?(DataMigrate::DatabaseConfigurationWrapper)
|
24
|
-
db_config = db_config.db_config
|
25
|
-
end
|
26
|
-
|
27
|
-
DataMigrate::DatabaseTasks.with_temporary_connection(db_config) do
|
28
|
-
if is_data_migration
|
29
|
-
DataMigrate::DataMigrator.run(:up, DataMigrate::DatabaseTasks.data_migrations_path, version)
|
30
|
-
else
|
31
|
-
ActiveRecord::Tasks::DatabaseTasks.migrate(version)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
9
|
+
DataMigrate::DatabaseTasks.migrate_with_data
|
37
10
|
Rake::Task["db:_dump"].invoke
|
38
11
|
Rake::Task["data:dump"].invoke
|
39
12
|
end
|
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: 9.4.
|
4
|
+
version: 9.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew J Vargo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-08-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|