active_record_shards 3.15.3 → 3.16.0

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
  SHA256:
3
- metadata.gz: e6173b1dc57889f56b60dc15ad031d64ea6494a4c11c9bfcf63ba68215012137
4
- data.tar.gz: efe84a0c10df29ef923e959aaf6c187d81dbd1f953ac30eda66457c8a344e0fc
3
+ metadata.gz: 320c1c800b0a4bc4bb03d35f3e783fb8384c93c691fe952a6eb631bd18d0bc56
4
+ data.tar.gz: 1135e185a0c6b40d0e4a154b71a1f265b9a098c2a7f6c23426e9d5ded29671cf
5
5
  SHA512:
6
- metadata.gz: 16dded6c3889b89e399f346fed1d9f779ce091a1abb7136e20c2e587c7fe6db6b58fcbdd8e6cce7969db2c1199a94420118964fa8715a65e0156b6a0dbf66e36
7
- data.tar.gz: ade8122972a9bfb7cec49957101856ecaf685f4174cc2b7400ddcfb0131f0b16996d68e464752e2e45495abf56141478898e33a9c573a6e0b821fa0ea997000f
6
+ metadata.gz: c9b285dbf64690f38ea439fdc626dd494649e78b1868fb0808de22a8c6661081c9f0548eb92a6b84bae8848a6fd4e2047817d9649fef0b760b32b0afee577cf6
7
+ data.tar.gz: 0ffe7e0d16eb27b15dbec72f2ca7308d653cdb4054693a2e3291137c1753e983bcd4ff76b1b99275f4993a5af3196dd456c224fb5ef46c3316e616d27ee77cb3
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ActiveRecord Shards is an extension for ActiveRecord that provides support for sharded database and slaves. Basically it is just a nice way to
6
6
  switch between database connections. We've made the implementation very small, and have tried not to reinvent any wheels already present in ActiveRecord.
7
7
 
8
- ActiveRecord Shards has been used and tested on Rails 4.2 and 5.0 and has in some form or another been used in production on a large Rails app for several years.
8
+ ActiveRecord Shards has been used and tested on Rails 4.2, 5.x and 6.0, and has in some form or another been used in production on large Rails apps for several years.
9
9
 
10
10
  - [Installation](#installation)
11
11
  - [Configuration](#configuration)
@@ -6,7 +6,7 @@ module ActiveRecordShards
6
6
  module_function
7
7
 
8
8
  def explode(conf)
9
- conf = conf.deep_dup
9
+ conf = conf.to_h.deep_dup
10
10
 
11
11
  conf.to_a.each do |env_name, env_config|
12
12
  next unless shards = env_config.delete('shards')
@@ -207,10 +207,10 @@ end
207
207
 
208
208
  case "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"
209
209
  when '4.2'
210
- require 'active_record_shards/connection_switcher-4-0'
210
+ require 'active_record_shards/connection_switcher-4-2'
211
211
  when '5.0'
212
212
  require 'active_record_shards/connection_switcher-5-0'
213
- when '5.1', '5.2'
213
+ when '5.1', '5.2', '6.0'
214
214
  require 'active_record_shards/connection_switcher-5-1'
215
215
  else
216
216
  raise "ActiveRecordShards is not compatible with #{ActiveRecord::VERSION::STRING}"
@@ -2,8 +2,10 @@
2
2
  module ActiveRecord
3
3
  class Migrator
4
4
  def self.shards_migration_context
5
- if ActiveRecord::VERSION::STRING >= '5.2.0'
6
- ActiveRecord::MigrationContext.new(['db/migrate'])
5
+ if ActiveRecord::VERSION::MAJOR >= 6
6
+ ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration)
7
+ elsif ActiveRecord::VERSION::STRING >= '5.2.0'
8
+ ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
7
9
  else
8
10
  self
9
11
  end
@@ -8,7 +8,7 @@ end
8
8
  namespace :db do
9
9
  desc 'Drops the database for the current RAILS_ENV including shards'
10
10
  task drop: :load_config do
11
- ActiveRecord::Base.configurations.each do |key, conf|
11
+ ActiveRecord::Base.configurations.to_h.each do |key, conf|
12
12
  next if !key.starts_with?(ActiveRecordShards.rails_env) || key.ends_with?("_slave")
13
13
  begin
14
14
  ActiveRecordShards::Tasks.root_connection(conf).drop_database(conf['database'])
@@ -28,7 +28,7 @@ namespace :db do
28
28
 
29
29
  desc "Create the database defined in config/database.yml for the current RAILS_ENV including shards"
30
30
  task create: :load_config do
31
- ActiveRecord::Base.configurations.each do |key, conf|
31
+ ActiveRecord::Base.configurations.to_h.each do |key, conf|
32
32
  next if !key.starts_with?(ActiveRecordShards.rails_env) || key.ends_with?("_slave")
33
33
  begin
34
34
  # MysqlAdapter takes charset instead of encoding in Rails 4.2 or greater
@@ -52,7 +52,10 @@ namespace :db do
52
52
  task abort_if_pending_migrations: :environment do
53
53
  if defined? ActiveRecord
54
54
  pending_migrations =
55
- if ActiveRecord::VERSION::STRING >= "5.2.0"
55
+ if ActiveRecord::VERSION::MAJOR >= 6
56
+ migrations = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration).migrations
57
+ ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration).pending_migrations
58
+ elsif ActiveRecord::VERSION::STRING >= "5.2.0"
56
59
  migrations = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrations
57
60
  ActiveRecord::Migrator.new(:up, migrations).pending_migrations
58
61
  else
@@ -31,7 +31,7 @@ ActiveRecord::SchemaDumper.prepend(ActiveRecordShards::SchemaDumperExtension)
31
31
  case "#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"
32
32
  when '4.2'
33
33
  require 'active_record_shards/patches-4-2'
34
- when '5.0', '5.1', '5.2'
34
+ when '5.0', '5.1', '5.2', '6.0'
35
35
  :ok
36
36
  else
37
37
  raise "ActiveRecordShards is not compatible with #{ActiveRecord::VERSION::STRING}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_shards
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.3
4
+ version: 3.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Quorning
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2019-11-05 00:00:00.000000000 Z
16
+ date: 2019-12-10 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
@@ -24,7 +24,7 @@ dependencies:
24
24
  version: '4.2'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '6.0'
27
+ version: '6.1'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: '4.2'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '6.0'
37
+ version: '6.1'
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: activesupport
40
40
  requirement: !ruby/object:Gem::Requirement
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '4.2'
45
45
  - - "<"
46
46
  - !ruby/object:Gem::Version
47
- version: '6.0'
47
+ version: '6.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '4.2'
55
55
  - - "<"
56
56
  - !ruby/object:Gem::Version
57
- version: '6.0'
57
+ version: '6.1'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -117,14 +117,14 @@ dependencies:
117
117
  requirements:
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: 5.10.0
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: '0'
127
+ version: 5.10.0
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: minitest-rg
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -159,14 +159,14 @@ dependencies:
159
159
  requirements:
160
160
  - - ">="
161
161
  - !ruby/object:Gem::Version
162
- version: 0.2.0
162
+ version: 0.6.0
163
163
  type: :development
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - ">="
168
168
  - !ruby/object:Gem::Version
169
- version: 0.2.0
169
+ version: 0.6.0
170
170
  description: Easily run queries on shard and slave databases.
171
171
  email:
172
172
  - bquorning@zendesk.com
@@ -184,7 +184,7 @@ files:
184
184
  - lib/active_record_shards/connection_handler.rb
185
185
  - lib/active_record_shards/connection_pool.rb
186
186
  - lib/active_record_shards/connection_specification.rb
187
- - lib/active_record_shards/connection_switcher-4-0.rb
187
+ - lib/active_record_shards/connection_switcher-4-2.rb
188
188
  - lib/active_record_shards/connection_switcher-5-0.rb
189
189
  - lib/active_record_shards/connection_switcher-5-1.rb
190
190
  - lib/active_record_shards/connection_switcher.rb