tako 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tako/railties/databases.rake +14 -6
- data/lib/tako/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d57edc16d1cde1831865a7eba1414a489cbbe1d
|
4
|
+
data.tar.gz: ecc1d7552a3c079f4a45e5c44fac71352eb736c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ecf25dffebf58ec6f5076eb53b510a455cc14912ca78bafdd50670cf46d401af4d91d48ea2aacf72e126de4593c5521a0617a03bd6fe8467a1cef744fac7f1b
|
7
|
+
data.tar.gz: 5d168488bddb04febbdd27177d927f7d095eb434b411e6981f8c7219cea588b3da3d3e318f51a32c75ee827aaef291f28e26e1842f9e7cb604a625193f2f8900
|
@@ -26,18 +26,26 @@ namespace :db do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
Tako.with_all_shards do
|
29
|
+
ActiveRecord::SchemaMigration.create_table
|
30
|
+
|
29
31
|
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
30
32
|
revert = !!ENV["DOWN_MIGRATION"]
|
31
33
|
|
32
34
|
migrations = if version
|
33
|
-
|
34
|
-
ActiveRecord::Migrator.migrations(paths).find {|proxy| proxy.version == version }.name.constantize
|
35
|
-
]
|
35
|
+
ActiveRecord::Migrator.migrations(paths).select {|proxy| proxy.version == version }
|
36
36
|
else
|
37
|
-
ActiveRecord::Migrator.migrations(paths)
|
37
|
+
ActiveRecord::Migrator.migrations(paths)
|
38
|
+
end
|
39
|
+
all_schema_migration_versions = ActiveRecord::SchemaMigration.pluck(:version)
|
40
|
+
migrations = migrations.reject {|proxy| all_schema_migration_versions.include?(proxy.version.to_s) }
|
41
|
+
migrations.each do |proxy|
|
42
|
+
ActiveRecord::Migration.run(proxy.name.constantize, revert: revert)
|
43
|
+
if revert
|
44
|
+
ActiveRecord::SchemaMigration.where(:version => proxy.version.to_s).delete_all
|
45
|
+
else
|
46
|
+
ActiveRecord::SchemaMigration.create!(:version => proxy.version.to_s)
|
47
|
+
end
|
38
48
|
end
|
39
|
-
|
40
|
-
ActiveRecord::Migration.run(*migrations, revert: revert)
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
data/lib/tako/version.rb
CHANGED