salsify-data_migrate 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/data_migrate/version.rb +1 -1
- data/tasks/databases.rake +29 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9bd7429fe1f9b79f9a0021c56ee6fcf17fdeda7
|
4
|
+
data.tar.gz: c98220680f6b4384ae8f6637801e59cdbec95ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf0b69a99231fd53f729cda41086ad43d81e23835abc3aa86f58a7831f03fafb3ea7d39789245c496d9cac932478d982e265bf00191a470265da69c7ec5f6c56
|
7
|
+
data.tar.gz: 9d0fa06a0e4bbb6709e3cd91a44a5ecd866a870273c19e7bdbfb036bdd2bb280b955dae5551d65b1d98030635408876588d594198dd88293846db6151ebae7f1
|
data/lib/data_migrate/version.rb
CHANGED
data/tasks/databases.rake
CHANGED
@@ -223,6 +223,21 @@ namespace :db do
|
|
223
223
|
puts "Current Data version: #{DataMigrate::DataMigrator.current_version}"
|
224
224
|
end
|
225
225
|
end
|
226
|
+
|
227
|
+
namespace :abort_if_pending_migrations do
|
228
|
+
desc "Raises an error if there are pending data or schema migrations"
|
229
|
+
task :with_data => :environment do
|
230
|
+
assure_data_schema_table
|
231
|
+
migrations = pending_migrations
|
232
|
+
if migrations.any?
|
233
|
+
puts "You have #{migrations.size} pending #{'migration'.pluralize(migrations.size)}:"
|
234
|
+
migrations.each do |migration|
|
235
|
+
puts ' %4d %6s %s' % [migration[:version], migration[:kind], migration[:name]]
|
236
|
+
end
|
237
|
+
abort %{Run `rails db:migrate:with_data` to update your database then try again.}
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
226
241
|
end
|
227
242
|
|
228
243
|
namespace :data do
|
@@ -317,6 +332,18 @@ namespace :data do
|
|
317
332
|
assure_data_schema_table
|
318
333
|
puts "Current data version: #{DataMigrate::DataMigrator.current_version}"
|
319
334
|
end
|
335
|
+
|
336
|
+
desc "Raises an error if there are pending data migrations"
|
337
|
+
task :abort_if_pending_migrations => :environment do
|
338
|
+
migrations = pending_data_migrations
|
339
|
+
if migrations.any?
|
340
|
+
puts "You have #{migrations.size} pending data #{'migration'.pluralize(migrations.size)}:"
|
341
|
+
migrations.each do |migration|
|
342
|
+
puts ' %4d %s' % [migration[:version], migration[:name]]
|
343
|
+
end
|
344
|
+
abort %{Run `rails data:migrate` to update your database then try again.}
|
345
|
+
end
|
346
|
+
end
|
320
347
|
end
|
321
348
|
|
322
349
|
def pending_migrations
|
@@ -326,7 +353,7 @@ end
|
|
326
353
|
def pending_data_migrations
|
327
354
|
data_migrations = DataMigrate::DataMigrator.migrations('db/data')
|
328
355
|
sort_migrations DataMigrate::DataMigrator.new(:up, data_migrations ).
|
329
|
-
pending_migrations.map{|m| { :version => m.version, :kind => :data }}
|
356
|
+
pending_migrations.map{|m| { :version => m.version, :kind => :data, :name => m.name }}
|
330
357
|
end
|
331
358
|
|
332
359
|
def pending_schema_migrations
|
@@ -334,7 +361,7 @@ def pending_schema_migrations
|
|
334
361
|
sort_migrations(
|
335
362
|
ActiveRecord::Migrator.new(:up, all_migrations).
|
336
363
|
pending_migrations.
|
337
|
-
map{|m| { :version => m.version, :kind => :schema }})
|
364
|
+
map{|m| { :version => m.version, :kind => :schema, :name => m.name }})
|
338
365
|
end
|
339
366
|
|
340
367
|
def sort_migrations set_1, set_2=nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salsify-data_migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|