activerecord-turntable 2.0.5 → 2.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16165f8a33bac2fc2a458d17e3cdbe26661c5e4e
4
- data.tar.gz: ae8c155b11f3998b574442e7041503eb0d0c905e
3
+ metadata.gz: d82829564262382156d47ab48a5331ee39507e2b
4
+ data.tar.gz: 2046ebf2f59a336a20d91df727c98da717a1b4f5
5
5
  SHA512:
6
- metadata.gz: af05b917a26c42a549de736397b4736c729a61cb5baba9986398d00c188175c1d98354b073b08dfbe1051aae5719470e1401f44f2d4228abd8d0214a66c0ac23
7
- data.tar.gz: b986e37ae2f98b4964bdea08d8358b36c73c8de2756362ae4bedfb6dc84c3fe3b189ce81920f14f2b53d878f80d4dbaea11dd6a5a172fe7b49d8fda11a2b740b
6
+ metadata.gz: a29ef422e6cbe7494c67c9480e541469ebbfc2773f48a0ef606c130ca7b6c791a6a8502cb23ce46f8fb739899b4ea4c438a46d348e3ca4d4e42b6cd93e9117ce
7
+ data.tar.gz: befc1adb93081acf2d9ba91c5cad860039b37530e484198334cec82935dc608719e8845dd83fe326d8da0c9add919222edfb5493033a2f8c69a256e712292a34
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## activerecord-turntable 2.0.6 ##
2
+
3
+ ### Bugfixes
4
+
5
+ * Fixes migration dsl:`clusters` is not working (thx macks)
6
+ * Fixes migration dsl:`shards` is not working
7
+
1
8
  ## activerecord-turntable 2.0.5 ##
2
9
 
3
10
  ### Bugfixes
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'activerecord', "= 4.2.0.beta4"
4
- gem 'activesupport', "= 4.2.0.beta4"
3
+ gem 'activerecord', "= 4.2.0.rc1"
4
+ gem 'activesupport', "= 4.2.0.rc1"
5
5
 
6
6
  gemspec :path => '../'
@@ -13,7 +13,7 @@ module ActiveRecord::Turntable::Migration
13
13
  module ShardDefinition
14
14
  def clusters(*cluster_names)
15
15
  config = ActiveRecord::Base.turntable_config
16
- (self.target_shards ||= []) <<
16
+ (self.target_shards ||= []).concat(
17
17
  if cluster_names.first == :all
18
18
  config['clusters'].map do |name, cluster_conf|
19
19
  cluster_conf["shards"].map {|shard| shard["connection"]}
@@ -23,12 +23,13 @@ module ActiveRecord::Turntable::Migration
23
23
  config['clusters'][cluster_name]["shards"].map do |shard|
24
24
  shard["connection"]
25
25
  end
26
- end
26
+ end.flatten
27
27
  end
28
+ )
28
29
  end
29
30
 
30
31
  def shards(*connection_names)
31
- (self.target_shards ||= []) << connection_names
32
+ (self.target_shards ||= []).concat connection_names
32
33
  end
33
34
  end
34
35
 
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Turntable
3
- VERSION = "2.0.5"
3
+ VERSION = "2.0.6"
4
4
  end
5
5
  end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveRecord::Turntable::Migration do
4
+ before(:all) do
5
+ reload_turntable!(File.join(File.dirname(__FILE__), "../../../config/turntable.yml"))
6
+ end
7
+
8
+ before(:each) do
9
+ establish_connection_to(:test)
10
+ truncate_shard
11
+ end
12
+
13
+ describe ".target_shards" do
14
+ subject { migration_class.new.target_shards }
15
+
16
+ context "With clusters definitions" do
17
+ let(:migration_class) {
18
+ klass = Class.new(ActiveRecord::Migration) {
19
+ clusters :user_cluster
20
+ }
21
+ }
22
+ let(:cluster_config) { ActiveRecord::Base.turntable_config["clusters"]["user_cluster"] }
23
+ let(:user_cluster_shards) { cluster_config["shards"].map { |s| s["connection"] } }
24
+
25
+ it { is_expected.to eq(user_cluster_shards) }
26
+ end
27
+
28
+ context "With shards definitions" do
29
+ let(:migration_class) {
30
+ klass = Class.new(ActiveRecord::Migration) {
31
+ shards :user_shard_01
32
+ }
33
+ }
34
+
35
+ it { is_expected.to eq([:user_shard_01]) }
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-turntable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - gussan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-20 00:00:00.000000000 Z
12
+ date: 2014-12-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -392,6 +392,7 @@ files:
392
392
  - spec/active_record/turntable/active_record_ext/association_spec.rb
393
393
  - spec/active_record/turntable/active_record_ext/clever_load_spec.rb
394
394
  - spec/active_record/turntable/active_record_ext/locking_optimistic_spec.rb
395
+ - spec/active_record/turntable/active_record_ext/migration_spec.rb
395
396
  - spec/active_record/turntable/active_record_ext/persistence_spec.rb
396
397
  - spec/active_record/turntable/algorithm/range_algorithm_spec.rb
397
398
  - spec/active_record/turntable/algorithm/range_bsearch_algorithm_spec.rb
@@ -449,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
449
450
  version: '0'
450
451
  requirements: []
451
452
  rubyforge_project: activerecord-turntable
452
- rubygems_version: 2.2.2
453
+ rubygems_version: 2.4.4
453
454
  signing_key:
454
455
  specification_version: 4
455
456
  summary: ActiveRecord sharding extension
@@ -458,6 +459,7 @@ test_files:
458
459
  - spec/active_record/turntable/active_record_ext/association_spec.rb
459
460
  - spec/active_record/turntable/active_record_ext/clever_load_spec.rb
460
461
  - spec/active_record/turntable/active_record_ext/locking_optimistic_spec.rb
462
+ - spec/active_record/turntable/active_record_ext/migration_spec.rb
461
463
  - spec/active_record/turntable/active_record_ext/persistence_spec.rb
462
464
  - spec/active_record/turntable/algorithm/range_algorithm_spec.rb
463
465
  - spec/active_record/turntable/algorithm/range_bsearch_algorithm_spec.rb
@@ -495,4 +497,3 @@ test_files:
495
497
  - spec/spec_helper.rb
496
498
  - spec/support/matchers/be_saved_to.rb
497
499
  - spec/support/turntable_helper.rb
498
- has_rdoc: