data_migrate 7.0.0 → 7.0.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 -1
- data/lib/data_migrate/version.rb +1 -1
- data/tasks/databases.rake +18 -32
- 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: eb3b56bd9d4670d332c63569b1744e1bb98af5f2f492ba3df0d4b80a5bdb7f7d
|
4
|
+
data.tar.gz: '08fe1b1769bf9c021aa2896e733d98100034d934e6a27492f6e455ad3f7475dd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d84302907054176f07464c0c4ec0f2340d43e90305477fb0da6dac29a597287628f26882590168c4bd8e2d376deacbde53d27e8e5458a6dbe0970f275462886
|
7
|
+
data.tar.gz: 055f2fe4fea33cc47d64976bd5c5f630099e0be193a7b01f01f76f4e272de20bdc43b5e6ba2de2888a1a60643ad4947af03dfa71190cb5b1812550eab9a95e1b
|
data/Changelog.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Changelog
|
2
|
+
## 7.0.1
|
3
|
+
Use SchemaMigrations.migration_paths in main rake task [lewhit](https://github.com/lewhit)
|
2
4
|
|
3
5
|
## 6.8.0
|
4
6
|
|
5
7
|
Specify database name for migrations_paths [lewhit](https://github.com/lewhit)
|
6
|
-
|
8
|
+
## 6.7.0
|
7
9
|
|
8
10
|
Add configuration for which database name is to be used for database migrations [lewhit](https://github.com/lewhit)
|
9
11
|
Add tests for Rails 6.1 [lewhit](https://github.com/lewhit)
|
data/lib/data_migrate/version.rb
CHANGED
data/tasks/databases.rake
CHANGED
@@ -46,17 +46,7 @@ namespace :db do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
migrations.each do |migration|
|
49
|
-
|
50
|
-
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
|
51
|
-
DataMigrate::DataMigrator.run(migration[:direction], data_migrations_path, migration[:version])
|
52
|
-
else
|
53
|
-
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
|
54
|
-
DataMigrate::SchemaMigration.run(
|
55
|
-
migration[:direction],
|
56
|
-
Rails.application.config.paths["db/migrate"],
|
57
|
-
migration[:version]
|
58
|
-
)
|
59
|
-
end
|
49
|
+
run_migration(migration, migration[:direction])
|
60
50
|
end
|
61
51
|
|
62
52
|
Rake::Task["db:_dump"].invoke
|
@@ -91,13 +81,7 @@ namespace :db do
|
|
91
81
|
end
|
92
82
|
|
93
83
|
migrations.each do |migration|
|
94
|
-
|
95
|
-
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
|
96
|
-
DataMigrate::DataMigrator.run(:up, data_migrations_path, migration[:version])
|
97
|
-
else
|
98
|
-
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
|
99
|
-
DataMigrate::SchemaMigration.run(:up, "db/migrate/", migration[:version])
|
100
|
-
end
|
84
|
+
run_migration(migration, :up)
|
101
85
|
end
|
102
86
|
|
103
87
|
Rake::Task["db:_dump"].invoke
|
@@ -119,13 +103,7 @@ namespace :db do
|
|
119
103
|
end
|
120
104
|
|
121
105
|
migrations.each do |migration|
|
122
|
-
|
123
|
-
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
|
124
|
-
DataMigrate::DataMigrator.run(:down, data_migrations_path, migration[:version])
|
125
|
-
else
|
126
|
-
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
|
127
|
-
DataMigrate::SchemaMigration.run(:down, "db/migrate/", migration[:version])
|
128
|
-
end
|
106
|
+
run_migration(migration, :down)
|
129
107
|
end
|
130
108
|
|
131
109
|
Rake::Task["db:_dump"].invoke
|
@@ -189,13 +167,7 @@ namespace :db do
|
|
189
167
|
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
|
190
168
|
assure_data_schema_table
|
191
169
|
past_migrations[0..(step - 1)].each do | past_migration |
|
192
|
-
|
193
|
-
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
|
194
|
-
DataMigrate::DataMigrator.run(:down, data_migrations_path, past_migration[:version])
|
195
|
-
elsif past_migration[:kind] == :schema
|
196
|
-
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
|
197
|
-
DataMigrate::SchemaMigration.run(:down, "db/migrate/", past_migration[:version])
|
198
|
-
end
|
170
|
+
run_migration(past_migration, :down)
|
199
171
|
end
|
200
172
|
|
201
173
|
Rake::Task["db:_dump"].invoke
|
@@ -412,3 +384,17 @@ end
|
|
412
384
|
def data_migrations_path
|
413
385
|
DataMigrate.config.data_migrations_path
|
414
386
|
end
|
387
|
+
|
388
|
+
def run_migration(migration, direction)
|
389
|
+
if migration[:kind] == :data
|
390
|
+
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
|
391
|
+
DataMigrate::DataMigrator.run(direction, data_migrations_path, migration[:version])
|
392
|
+
else
|
393
|
+
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
|
394
|
+
DataMigrate::SchemaMigration.run(
|
395
|
+
direction,
|
396
|
+
DataMigrate::SchemaMigration.migrations_paths,
|
397
|
+
migration[:version]
|
398
|
+
)
|
399
|
+
end
|
400
|
+
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: 7.0.
|
4
|
+
version: 7.0.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: 2021-
|
13
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|