data_migrate 9.4.0 → 9.4.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b1c79f9a3a6b30aeb19f85dd46e0c7d29885f3552787924f27eeb80f1738e95
4
- data.tar.gz: 56ff3a64d6cde029b8a6e9f57c82ebf15ad86aa0140520d5a08c67a8a30e9869
3
+ metadata.gz: aa16e421f2f5d046c5e78678b226574ddaeca7345bfcff5f8ab69091fb901f3c
4
+ data.tar.gz: 91d60c54724dc47e6aac6f7638275c005c0f27f052741c00fbed0f15fb8056b7
5
5
  SHA512:
6
- metadata.gz: 6b8d1bb7fd343e44f0cdf623fda3e52875e4efee1327bc4fbf2e3700b1071a96e3b50bb88a63ef4f94c98fcdb068c81f47a4a94d3ee80e91f4d9b47d84893234
7
- data.tar.gz: bbbcc92d53620c487cdce34a99dd5c41ddb156fa6a8a1a1b8304f1750af2c696df2c1f12079d9ec320b7f1a13497ab35ea20d19a0e1c5f33b3e7a7b2804a8ca0
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.0)
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.2)
12
- actionview (= 7.1.3.2)
13
- activesupport (= 7.1.3.2)
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.2)
22
- activesupport (= 7.1.3.2)
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.2)
28
- activesupport (= 7.1.3.2)
29
- activerecord (7.1.3.2)
30
- activemodel (= 7.1.3.2)
31
- activesupport (= 7.1.3.2)
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.2)
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.6)
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.2.3)
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.0)
58
- ruby2_keywords
57
+ drb (2.2.1)
59
58
  erubi (1.12.0)
60
- i18n (1.14.1)
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.22.2)
72
+ minitest (5.23.1)
74
73
  mutex_m (0.2.0)
75
- nokogiri (1.16.2-arm64-darwin)
74
+ nokogiri (1.16.5-arm64-darwin)
76
75
  racc (~> 1.4)
77
- nokogiri (1.16.2-x86_64-linux)
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.7.3)
93
- rack (3.0.9.1)
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.2)
109
- actionpack (= 7.1.3.2)
110
- activesupport (= 7.1.3.2)
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.6)
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)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- data_migrate (9.4.0)
4
+ data_migrate (9.4.1)
5
5
  activerecord (>= 6.1)
6
6
  railties (>= 6.1)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- data_migrate (9.4.0)
4
+ data_migrate (9.4.1)
5
5
  activerecord (>= 6.1)
6
6
  railties (>= 6.1)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- data_migrate (9.4.0)
4
+ data_migrate (9.4.1)
5
5
  activerecord (>= 6.1)
6
6
  railties (>= 6.1)
7
7
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "9.4.0".freeze
2
+ VERSION = "9.4.1".freeze
3
3
  end
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::DataMigrator.create_data_schema_table
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.0
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-04-29 00:00:00.000000000 Z
13
+ date: 2024-08-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord