switchman 2.1.0 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +10 -2
  3. data/app/models/switchman/shard.rb +270 -343
  4. data/app/models/switchman/unsharded_record.rb +7 -0
  5. data/db/migrate/20130328212039_create_switchman_shards.rb +1 -1
  6. data/db/migrate/20130328224244_create_default_shard.rb +5 -5
  7. data/db/migrate/20161206323434_add_back_default_string_limits_switchman.rb +1 -0
  8. data/db/migrate/20180828183945_add_default_shard_index.rb +2 -2
  9. data/db/migrate/20180828192111_add_timestamps_to_shards.rb +8 -6
  10. data/db/migrate/20190114212900_add_unique_name_indexes.rb +5 -3
  11. data/lib/switchman/action_controller/caching.rb +2 -2
  12. data/lib/switchman/active_record/abstract_adapter.rb +0 -8
  13. data/lib/switchman/active_record/association.rb +78 -89
  14. data/lib/switchman/active_record/attribute_methods.rb +127 -52
  15. data/lib/switchman/active_record/base.rb +83 -67
  16. data/lib/switchman/active_record/calculations.rb +73 -66
  17. data/lib/switchman/active_record/connection_pool.rb +12 -59
  18. data/lib/switchman/active_record/database_configurations/database_config.rb +13 -0
  19. data/lib/switchman/active_record/database_configurations.rb +34 -0
  20. data/lib/switchman/active_record/finder_methods.rb +11 -16
  21. data/lib/switchman/active_record/log_subscriber.rb +4 -8
  22. data/lib/switchman/active_record/migration.rb +19 -45
  23. data/lib/switchman/active_record/model_schema.rb +1 -1
  24. data/lib/switchman/active_record/persistence.rb +11 -6
  25. data/lib/switchman/active_record/postgresql_adapter.rb +33 -161
  26. data/lib/switchman/active_record/predicate_builder.rb +1 -1
  27. data/lib/switchman/active_record/query_cache.rb +18 -19
  28. data/lib/switchman/active_record/query_methods.rb +178 -193
  29. data/lib/switchman/active_record/reflection.rb +7 -22
  30. data/lib/switchman/active_record/relation.rb +32 -29
  31. data/lib/switchman/active_record/spawn_methods.rb +27 -29
  32. data/lib/switchman/active_record/statement_cache.rb +18 -35
  33. data/lib/switchman/active_record/tasks/database_tasks.rb +16 -0
  34. data/lib/switchman/active_record/test_fixtures.rb +43 -0
  35. data/lib/switchman/active_support/cache.rb +3 -5
  36. data/lib/switchman/arel.rb +13 -8
  37. data/lib/switchman/database_server.rb +130 -154
  38. data/lib/switchman/default_shard.rb +52 -16
  39. data/lib/switchman/engine.rb +65 -58
  40. data/lib/switchman/environment.rb +4 -8
  41. data/lib/switchman/errors.rb +1 -0
  42. data/lib/switchman/guard_rail/relation.rb +5 -7
  43. data/lib/switchman/guard_rail.rb +6 -19
  44. data/lib/switchman/r_spec_helper.rb +29 -57
  45. data/lib/switchman/rails.rb +14 -12
  46. data/lib/switchman/sharded_instrumenter.rb +1 -1
  47. data/lib/switchman/standard_error.rb +15 -3
  48. data/lib/switchman/test_helper.rb +5 -3
  49. data/lib/switchman/version.rb +1 -1
  50. data/lib/switchman.rb +3 -3
  51. data/lib/tasks/switchman.rake +61 -72
  52. metadata +90 -48
  53. data/lib/switchman/active_record/batches.rb +0 -11
  54. data/lib/switchman/active_record/connection_handler.rb +0 -190
  55. data/lib/switchman/active_record/where_clause_factory.rb +0 -36
  56. data/lib/switchman/connection_pool_proxy.rb +0 -173
  57. data/lib/switchman/schema_cache.rb +0 -28
@@ -1,20 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Switchman
2
4
  module Rake
3
5
  def self.filter_database_servers(&block)
4
6
  chain = filter_database_servers_chain # use a local variable so that the current chain is closed over in the following lambda
5
- @filter_database_servers_chain = lambda { |servers| block.call(servers, chain) }
7
+ @filter_database_servers_chain = ->(servers) { block.call(servers, chain) }
6
8
  end
7
9
 
8
10
  def self.scope(base_scope = Shard,
9
- database_server: ENV['DATABASE_SERVER'],
10
- shard: ENV['SHARD'])
11
+ database_server: ENV['DATABASE_SERVER'],
12
+ shard: ENV['SHARD'])
11
13
  servers = DatabaseServer.all
12
14
 
13
15
  if database_server
14
16
  servers = database_server
15
17
  if servers.first == '-'
16
18
  negative = true
17
- servers = servers[1..-1]
19
+ servers = servers[1..]
18
20
  end
19
21
  servers = servers.split(',')
20
22
  open = servers.delete('open')
@@ -31,29 +33,27 @@ module Switchman
31
33
 
32
34
  servers = filter_database_servers_chain.call(servers)
33
35
 
34
- scope = base_scope.order(::Arel.sql("database_server_id IS NOT NULL, database_server_id, id"))
36
+ scope = base_scope.order(::Arel.sql('database_server_id IS NOT NULL, database_server_id, id'))
35
37
  if servers != DatabaseServer.all
36
- conditions = ["database_server_id IN (?)", servers.map(&:id)]
37
- conditions.first << " OR database_server_id IS NULL" if servers.include?(Shard.default.database_server)
38
+ conditions = ['database_server_id IN (?)', servers.map(&:id)]
39
+ conditions.first << ' OR database_server_id IS NULL' if servers.include?(Shard.default.database_server)
38
40
  scope = scope.where(conditions)
39
41
  end
40
42
 
41
- if shard
42
- scope = shard_scope(scope, shard)
43
- end
43
+ scope = shard_scope(scope, shard) if shard
44
44
 
45
45
  scope
46
46
  end
47
47
 
48
48
  def self.options
49
- { parallel: ENV['PARALLEL'].to_i, max_procs: ENV['MAX_PARALLEL_PROCS'] }
49
+ { parallel: ENV['PARALLEL'].to_i }
50
50
  end
51
51
 
52
- # categories - an array or proc, to activate as the current shard during the
52
+ # classes - an array or proc, to activate as the current shard during the
53
53
  # task. tasks which modify the schema may want to pass all categories in
54
54
  # so that schema updates for non-default tables happen against all shards.
55
55
  # this is handled automatically for the default migration tasks, below.
56
- def self.shardify_task(task_name, categories: [:primary])
56
+ def self.shardify_task(task_name, classes: [::ActiveRecord::Base])
57
57
  old_task = ::Rake::Task[task_name]
58
58
  old_actions = old_task.actions.dup
59
59
  old_task.actions.clear
@@ -66,43 +66,30 @@ module Switchman
66
66
 
67
67
  ::GuardRail.activate(:deploy) do
68
68
  Shard.default.database_server.unguard do
69
- begin
70
- categories = categories.call if categories.respond_to?(:call)
71
- Shard.with_each_shard(scope, categories, options) do
72
- shard = Shard.current
73
- puts "#{shard.id}: #{shard.description}"
74
- ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
75
- if ::Rails.version < '6.0'
76
- ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
77
- else
78
- # Adopted from the deprecated code that currently lives in rails proper
79
- remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
80
- new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env =>
81
- ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys).configurations
82
- new_configs = remaining_configs + new_config
83
-
84
- ::ActiveRecord::Base.configurations = new_configs
85
- end
86
- shard.database_server.unguard do
87
- old_actions.each { |action| action.call(*task_args) }
88
- end
89
- nil
69
+ classes = classes.call if classes.respond_to?(:call)
70
+ Shard.with_each_shard(scope, classes, **options) do
71
+ shard = Shard.current
72
+ puts "#{shard.id}: #{shard.description}"
73
+
74
+ shard.database_server.unguard do
75
+ old_actions.each { |action| action.call(*task_args) }
90
76
  end
91
- rescue => e
92
- puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
93
- raise
77
+ nil
94
78
  end
79
+ rescue => e
80
+ puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
81
+ raise
82
+
83
+ # ::ActiveRecord::Base.configurations = old_configurations
95
84
  end
96
85
  end
97
86
  end
98
87
  end
99
88
 
100
- %w{db:migrate db:migrate:up db:migrate:down db:rollback}.each do |task_name|
101
- shardify_task(task_name, categories: ->{ Shard.categories })
89
+ %w[db:migrate db:migrate:up db:migrate:down db:rollback].each do |task_name|
90
+ shardify_task(task_name)
102
91
  end
103
92
 
104
- private
105
-
106
93
  def self.shard_scope(scope, raw_shard_ids)
107
94
  raw_shard_ids = raw_shard_ids.split(',')
108
95
 
@@ -125,6 +112,7 @@ module Switchman
125
112
  when /^(-?)(\d+)?\.\.(\.)?(\d+)?$/
126
113
  negative, start, open, finish = $1.present?, $2, $3.present?, $4
127
114
  raise "Invalid shard id or range: #{id}" unless start || finish
115
+
128
116
  range = []
129
117
  range << "id>=#{start}" if start
130
118
  range << "id<#{'=' unless open}#{finish}" if finish
@@ -136,12 +124,12 @@ module Switchman
136
124
  when %r{^(-?\d+)/(\d+)$}
137
125
  numerator = $1.to_i
138
126
  denominator = $2.to_i
139
- if numerator == 0 || numerator.abs > denominator
140
- raise "Invalid fractional chunk: #{id}"
141
- end
127
+ raise "Invalid fractional chunk: #{id}" if numerator.zero? || numerator.abs > denominator
128
+
142
129
  # one chunk means everything
143
130
  if denominator == 1
144
131
  next if numerator == 1
132
+
145
133
  return scope.none
146
134
  end
147
135
 
@@ -156,24 +144,25 @@ module Switchman
156
144
  select = []
157
145
  if index != 1
158
146
  subscope = subscope.offset(per_chunk * (index - 1))
159
- select << "MIN(id) AS min_id"
147
+ select << 'MIN(id) AS min_id'
160
148
  end
161
149
  if index != denominator
162
150
  subscope = subscope.limit(per_chunk)
163
- select << "MAX(id) AS max_id"
164
- end
165
-
166
- result = Shard.from(subscope).select(select.join(", ")).to_a.first
167
- if index == 1
168
- range = "id<=#{result['max_id']}"
169
- elsif index == denominator
170
- range = "id>=#{result['min_id']}"
171
- else
172
- range = "(id>=#{result['min_id']} AND id<=#{result['max_id']})"
151
+ select << 'MAX(id) AS max_id'
173
152
  end
174
153
 
175
- (numerator < 0 ? negative_ranges : ranges) << range
176
- else
154
+ result = Shard.from(subscope).select(select.join(', ')).to_a.first
155
+ range = case index
156
+ when 1
157
+ "id<=#{result['max_id']}"
158
+ when denominator
159
+ "id>=#{result['min_id']}"
160
+ else
161
+ "(id>=#{result['min_id']} AND id<=#{result['max_id']})"
162
+ end
163
+
164
+ (numerator.negative? ? negative_ranges : ranges) << range
165
+ else
177
166
  raise "Invalid shard id or range: #{id}"
178
167
  end
179
168
  end
@@ -182,27 +171,24 @@ module Switchman
182
171
  negative_shard_ids.uniq!
183
172
  unless shard_ids.empty?
184
173
  shard_ids -= negative_shard_ids
185
- if shard_ids.empty? && ranges.empty?
186
- return scope.none
187
- end
174
+ return scope.none if shard_ids.empty? && ranges.empty?
175
+
188
176
  # we already trimmed them all out; no need to make the server do it as well
189
177
  negative_shard_ids = [] if ranges.empty?
190
178
  end
191
179
 
192
180
  conditions = []
193
181
  positive_queries = []
194
- unless ranges.empty?
195
- positive_queries << ranges.join(" OR ")
196
- end
182
+ positive_queries << ranges.join(' OR ') unless ranges.empty?
197
183
  unless shard_ids.empty?
198
- positive_queries << "id IN (?)"
184
+ positive_queries << 'id IN (?)'
199
185
  conditions << shard_ids
200
186
  end
201
- positive_query = positive_queries.join(" OR ")
187
+ positive_query = positive_queries.join(' OR ')
202
188
  scope = scope.where(positive_query, *conditions) unless positive_queries.empty?
203
189
 
204
- scope = scope.where("NOT (#{negative_ranges.join(" OR")})") unless negative_ranges.empty?
205
- scope = scope.where("id NOT IN (?)", negative_shard_ids) unless negative_shard_ids.empty?
190
+ scope = scope.where("NOT (#{negative_ranges.join(' OR')})") unless negative_ranges.empty?
191
+ scope = scope.where('id NOT IN (?)', negative_shard_ids) unless negative_shard_ids.empty?
206
192
  scope
207
193
  end
208
194
 
@@ -213,18 +199,21 @@ module Switchman
213
199
 
214
200
  module ActiveRecord
215
201
  module PostgreSQLDatabaseTasks
216
- def structure_dump(filename, extra_flags=nil)
202
+ def structure_dump(filename, extra_flags = nil)
217
203
  set_psql_env
218
- args = ['-s', '-x', '-O', '-f', filename]
204
+ args = ['--schema-only', '--no-privileges', '--no-owner', '--file', filename]
219
205
  args.concat(Array(extra_flags)) if extra_flags
220
- search_path = configuration['schema_search_path']
221
206
  shard = Shard.current.name
222
207
  serialized_search_path = shard
223
208
  args << "--schema=#{Shellwords.escape(shard)}"
224
209
 
225
- args << configuration['database']
210
+ ignore_tables = ::ActiveRecord::SchemaDumper.ignore_tables
211
+ args += ignore_tables.flat_map { |table| ['-T', table] } if ignore_tables.any?
212
+
213
+ args << db_config.database
226
214
  run_cmd('pg_dump', args, 'dumping')
227
- File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
215
+ remove_sql_header_comments(filename)
216
+ File.open(filename, 'a') { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
228
217
  end
229
218
  end
230
219
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,90 +10,90 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-12 00:00:00.000000000 Z
13
+ date: 2022-02-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: railties
16
+ name: activerecord
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '5.1'
21
+ version: 6.1.4
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '6.1'
24
+ version: '6.2'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: '5.1'
31
+ version: 6.1.4
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '6.1'
34
+ version: '6.2'
35
35
  - !ruby/object:Gem::Dependency
36
- name: activerecord
36
+ name: guardrail
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '5.1'
42
- - - "<"
39
+ - - "~>"
43
40
  - !ruby/object:Gem::Version
44
- version: '6.1'
41
+ version: 3.0.0
45
42
  type: :runtime
46
43
  prerelease: false
47
44
  version_requirements: !ruby/object:Gem::Requirement
48
45
  requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- version: '5.1'
52
- - - "<"
46
+ - - "~>"
53
47
  - !ruby/object:Gem::Version
54
- version: '6.1'
48
+ version: 3.0.0
55
49
  - !ruby/object:Gem::Dependency
56
- name: guardrail
50
+ name: open4
57
51
  requirement: !ruby/object:Gem::Requirement
58
52
  requirements:
59
53
  - - "~>"
60
54
  - !ruby/object:Gem::Version
61
- version: 2.0.0
55
+ version: 1.3.0
62
56
  type: :runtime
63
57
  prerelease: false
64
58
  version_requirements: !ruby/object:Gem::Requirement
65
59
  requirements:
66
60
  - - "~>"
67
61
  - !ruby/object:Gem::Version
68
- version: 2.0.0
62
+ version: 1.3.0
69
63
  - !ruby/object:Gem::Dependency
70
- name: open4
64
+ name: railties
71
65
  requirement: !ruby/object:Gem::Requirement
72
66
  requirements:
73
- - - "~>"
67
+ - - ">="
74
68
  - !ruby/object:Gem::Version
75
- version: 1.3.0
69
+ version: '6.1'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '6.2'
76
73
  type: :runtime
77
74
  prerelease: false
78
75
  version_requirements: !ruby/object:Gem::Requirement
79
76
  requirements:
80
- - - "~>"
77
+ - - ">="
81
78
  - !ruby/object:Gem::Version
82
- version: 1.3.0
79
+ version: '6.1'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: appraisal
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '2.1'
89
+ version: 2.3.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '2.1'
96
+ version: 2.3.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: byebug
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pg
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.2'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: pry
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -123,21 +137,21 @@ dependencies:
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
- name: pg
140
+ name: rake
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '0'
145
+ version: '13.0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0'
152
+ version: '13.0'
139
153
  - !ruby/object:Gem::Dependency
140
- name: rspec-rails
154
+ name: rspec-mocks
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
157
  - - "~>"
@@ -151,47 +165,75 @@ dependencies:
151
165
  - !ruby/object:Gem::Version
152
166
  version: '3.5'
153
167
  - !ruby/object:Gem::Dependency
154
- name: rspec-mocks
168
+ name: rspec-rails
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
171
  - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '3.5'
173
+ version: '4.0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '3.5'
180
+ version: '4.0'
167
181
  - !ruby/object:Gem::Dependency
168
- name: simplecov
182
+ name: rubocop
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0.15'
187
+ version: '1.10'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0.15'
194
+ version: '1.10'
181
195
  - !ruby/object:Gem::Dependency
182
- name: rake
196
+ name: rubocop-rake
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "~>"
200
+ - !ruby/object:Gem::Version
201
+ version: '0.5'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "~>"
207
+ - !ruby/object:Gem::Version
208
+ version: '0.5'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop-rspec
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
213
  - - "~>"
186
214
  - !ruby/object:Gem::Version
187
- version: '12.0'
215
+ version: '2.2'
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
220
  - - "~>"
193
221
  - !ruby/object:Gem::Version
194
- version: '12.0'
222
+ version: '2.2'
223
+ - !ruby/object:Gem::Dependency
224
+ name: simplecov
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '0.15'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '0.15'
195
237
  description: Sharding
196
238
  email:
197
239
  - cody@instructure.com
@@ -201,6 +243,7 @@ extra_rdoc_files: []
201
243
  files:
202
244
  - Rakefile
203
245
  - app/models/switchman/shard.rb
246
+ - app/models/switchman/unsharded_record.rb
204
247
  - db/migrate/20130328212039_create_switchman_shards.rb
205
248
  - db/migrate/20130328224244_create_default_shard.rb
206
249
  - db/migrate/20161206323434_add_back_default_string_limits_switchman.rb
@@ -213,10 +256,10 @@ files:
213
256
  - lib/switchman/active_record/association.rb
214
257
  - lib/switchman/active_record/attribute_methods.rb
215
258
  - lib/switchman/active_record/base.rb
216
- - lib/switchman/active_record/batches.rb
217
259
  - lib/switchman/active_record/calculations.rb
218
- - lib/switchman/active_record/connection_handler.rb
219
260
  - lib/switchman/active_record/connection_pool.rb
261
+ - lib/switchman/active_record/database_configurations.rb
262
+ - lib/switchman/active_record/database_configurations/database_config.rb
220
263
  - lib/switchman/active_record/finder_methods.rb
221
264
  - lib/switchman/active_record/log_subscriber.rb
222
265
  - lib/switchman/active_record/migration.rb
@@ -231,12 +274,12 @@ files:
231
274
  - lib/switchman/active_record/spawn_methods.rb
232
275
  - lib/switchman/active_record/statement_cache.rb
233
276
  - lib/switchman/active_record/table_definition.rb
277
+ - lib/switchman/active_record/tasks/database_tasks.rb
278
+ - lib/switchman/active_record/test_fixtures.rb
234
279
  - lib/switchman/active_record/type_caster.rb
235
- - lib/switchman/active_record/where_clause_factory.rb
236
280
  - lib/switchman/active_support/cache.rb
237
281
  - lib/switchman/arel.rb
238
282
  - lib/switchman/call_super.rb
239
- - lib/switchman/connection_pool_proxy.rb
240
283
  - lib/switchman/database_server.rb
241
284
  - lib/switchman/default_shard.rb
242
285
  - lib/switchman/engine.rb
@@ -247,7 +290,6 @@ files:
247
290
  - lib/switchman/open4.rb
248
291
  - lib/switchman/r_spec_helper.rb
249
292
  - lib/switchman/rails.rb
250
- - lib/switchman/schema_cache.rb
251
293
  - lib/switchman/sharded_instrumenter.rb
252
294
  - lib/switchman/standard_error.rb
253
295
  - lib/switchman/test_helper.rb
@@ -265,14 +307,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
307
  requirements:
266
308
  - - ">="
267
309
  - !ruby/object:Gem::Version
268
- version: '2.5'
310
+ version: '2.6'
269
311
  required_rubygems_version: !ruby/object:Gem::Requirement
270
312
  requirements:
271
313
  - - ">="
272
314
  - !ruby/object:Gem::Version
273
315
  version: '0'
274
316
  requirements: []
275
- rubygems_version: 3.2.15
317
+ rubygems_version: 3.1.4
276
318
  signing_key:
277
319
  specification_version: 4
278
320
  summary: Rails sharding magic
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Switchman
4
- module ActiveRecord
5
- module Batches
6
- def batch_order
7
- ::Arel.sql("#{connection.quote_local_table_name(table_name)}.#{quoted_primary_key} ASC")
8
- end
9
- end
10
- end
11
- end