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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a82be704e2e0880ab3426fc9163a9f1250a7076d
4
- data.tar.gz: e50d4657aaf871ef963667b7b698dd4ddec5e11c
3
+ metadata.gz: 5d57edc16d1cde1831865a7eba1414a489cbbe1d
4
+ data.tar.gz: ecc1d7552a3c079f4a45e5c44fac71352eb736c2
5
5
  SHA512:
6
- metadata.gz: 0a485cfdbee384d8a06c2f4e7fce0d1818563a5ffc78823298c223ceeafb6a1e76749ff07ca924fb8bf4bc532e99bb7036f6a4d2e38a646d1cb9b18a8f0317fc
7
- data.tar.gz: 53581d736088ca0fd23dc166e70feeee0c68639bfda4ebd22f8046320329e68d4f1c265b6015954f9722c0e63eb491a37b09f5e14d6a8371cd5783e6fcaf2d2d
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).map(&:name).map(&:constantize)
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
@@ -1,3 +1,3 @@
1
1
  module Tako
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tako
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masashi AKISUE