data_migrate 9.4.1 → 9.4.2
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 +1 -1
- 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 +37 -0
- data/lib/data_migrate/version.rb +1 -1
- data/tasks/databases.rake +7 -0
- 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: b061a1b90d162a48df5225719ec96da94aaa77d0580d952a1ff0f4cb895e452e
|
4
|
+
data.tar.gz: bc78e03d816377c6a784b8102ce9f6c9504ee4650839436a92b1a949bce6a45d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c612eefd1985b3935c79c87039f1f67db81088a1984fb4e90d15c361d9c0fd90b9acefaeb131ec4b77f22a56f6524a99444e663b5e2e2a820115864b09471ed
|
7
|
+
data.tar.gz: b2ce56c6fd8510adb0eb465fc765df93fdce42f6d7f81e809276bbaf29f7e1891dd7638191e395af0afb774f1ced8fc33387a9619b09edf24cde824b03aa00a6
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -204,5 +204,42 @@ module DataMigrate
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
end
|
207
|
+
|
208
|
+
def self.prepare_all_with_data
|
209
|
+
seed = false
|
210
|
+
|
211
|
+
each_current_configuration(env) do |db_config|
|
212
|
+
next unless db_config.primary?
|
213
|
+
|
214
|
+
with_temporary_pool(db_config) do
|
215
|
+
begin
|
216
|
+
database_initialized = migration_connection.schema_migration.table_exists?
|
217
|
+
rescue ActiveRecord::NoDatabaseError
|
218
|
+
create(db_config)
|
219
|
+
retry
|
220
|
+
end
|
221
|
+
|
222
|
+
unless database_initialized
|
223
|
+
if File.exist?(schema_dump_path(db_config))
|
224
|
+
load_schema(db_config, ActiveRecord.schema_format, nil)
|
225
|
+
load_schema_current(
|
226
|
+
:ruby,
|
227
|
+
ENV["DATA_SCHEMA"]
|
228
|
+
)
|
229
|
+
end
|
230
|
+
|
231
|
+
seed = true
|
232
|
+
end
|
233
|
+
|
234
|
+
migrate_with_data
|
235
|
+
if ActiveRecord.dump_schema_after_migration
|
236
|
+
dump_schema(db_config)
|
237
|
+
DataMigrate::Tasks::DataMigrateTasks.dump
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
load_seed if seed
|
243
|
+
end
|
207
244
|
end
|
208
245
|
end
|
data/lib/data_migrate/version.rb
CHANGED
data/tasks/databases.rake
CHANGED
@@ -146,6 +146,13 @@ namespace :db do
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
149
|
+
|
150
|
+
namespace :prepare do
|
151
|
+
desc "Runs setup if database does not exist, or runs data and schema migrations if it does"
|
152
|
+
task with_data: :environment do
|
153
|
+
DataMigrate::DatabaseTasks.prepare_all_with_data
|
154
|
+
end
|
155
|
+
end
|
149
156
|
end
|
150
157
|
|
151
158
|
namespace :data do
|
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.2
|
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-08-
|
13
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|