tako 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/gemfiles/rails_42.gemfile +1 -1
- data/gemfiles/rails_50.gemfile +1 -1
- data/gemfiles/rails_51.gemfile +1 -1
- data/gemfiles/rails_52.gemfile +1 -1
- data/gemfiles/rails_edge.gemfile +1 -1
- data/lib/tako/active_record_ext/connection_handling.rb +1 -0
- data/lib/tako/railties/databases.rake +8 -3
- data/lib/tako/repository.rb +7 -7
- data/lib/tako/version.rb +1 -1
- 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: d8c09725ee3badc216ffb331810b51c2583e3136
|
4
|
+
data.tar.gz: c0c076d271e624f1ce71e023ff3c876b56df32ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68cb0d10411f90ccadeca75eba70a97a5dc9f17b750710f513f4a37ab146056ae841140530d299a08c40f76ba9e70823277a653d96858597667b3715fc1a71f6
|
7
|
+
data.tar.gz: 6e3570f94b6f0714252a24d3a6cd91b633f0fcf898e80d14c0d39cee2d9b3b6569e8278de975d5b03dc17920b8a6ba70ad86ce5c9c6b1a2640589fe326a1fb54
|
data/gemfiles/rails_42.gemfile
CHANGED
data/gemfiles/rails_50.gemfile
CHANGED
data/gemfiles/rails_51.gemfile
CHANGED
data/gemfiles/rails_52.gemfile
CHANGED
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -31,11 +31,12 @@ namespace :db do
|
|
31
31
|
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
32
32
|
revert = !!ENV["DOWN_MIGRATION"]
|
33
33
|
|
34
|
-
migrations = if
|
35
|
-
ActiveRecord::
|
34
|
+
migrations = if defined?(ActiveRecord::MigrationContext)
|
35
|
+
ActiveRecord::MigrationContext.new(paths).migrations
|
36
36
|
else
|
37
37
|
ActiveRecord::Migrator.migrations(paths)
|
38
38
|
end
|
39
|
+
migrations.select! {|proxy| proxy.version == version } if version
|
39
40
|
all_schema_migration_versions = ActiveRecord::SchemaMigration.pluck(:version)
|
40
41
|
migrations = migrations.reject {|proxy| all_schema_migration_versions.include?(proxy.version.to_s) }
|
41
42
|
migrations.each do |proxy|
|
@@ -49,7 +50,11 @@ namespace :db do
|
|
49
50
|
|
50
51
|
if defined?(ActiveRecord::InternalMetadata)
|
51
52
|
ActiveRecord::InternalMetadata.create_table
|
52
|
-
ActiveRecord::InternalMetadata[:environment] = ActiveRecord::
|
53
|
+
ActiveRecord::InternalMetadata[:environment] = if defined?(ActiveRecord::MigrationContext)
|
54
|
+
ActiveRecord::MigrationContext.new(paths).current_environment
|
55
|
+
else
|
56
|
+
ActiveRecord::Migrator.current_environment
|
57
|
+
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
end
|
data/lib/tako/repository.rb
CHANGED
@@ -5,17 +5,17 @@ module Tako
|
|
5
5
|
@proxy_configs ||= {}
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
@
|
8
|
+
def proxy_classes
|
9
|
+
@proxy_classes ||= {}
|
10
10
|
end
|
11
11
|
|
12
12
|
def clear
|
13
|
-
|
14
|
-
connection.disconnect!
|
13
|
+
proxy_classes.each do |shard_name, proxy_class|
|
14
|
+
proxy_class.connection.disconnect!
|
15
15
|
remove_const("TAKO_AR_CLASS_#{shard_name.upcase}")
|
16
16
|
end
|
17
17
|
proxy_configs.clear
|
18
|
-
|
18
|
+
proxy_classes.clear
|
19
19
|
end
|
20
20
|
|
21
21
|
def add(shard_name, conf)
|
@@ -26,12 +26,12 @@ module Tako
|
|
26
26
|
const_set("TAKO_AR_CLASS_#{shard_name.upcase}", temporary_class)
|
27
27
|
temporary_class.establish_connection(conf)
|
28
28
|
|
29
|
-
|
29
|
+
proxy_classes[shard_name] = temporary_class
|
30
30
|
proxy_configs[shard_name] = conf
|
31
31
|
end
|
32
32
|
|
33
33
|
def create_proxy(shard_name)
|
34
|
-
Proxy.new(shard_name,
|
34
|
+
Proxy.new(shard_name, proxy_classes[shard_name.to_sym].connection_without_tako)
|
35
35
|
end
|
36
36
|
|
37
37
|
def shard_names
|
data/lib/tako/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tako
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masashi AKISUE
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|