switchman 2.2.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +10 -2
  3. data/app/models/switchman/shard.rb +272 -275
  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 +7 -5
  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 +1 -0
  13. data/lib/switchman/active_record/association.rb +78 -89
  14. data/lib/switchman/active_record/attribute_methods.rb +58 -73
  15. data/lib/switchman/active_record/base.rb +59 -60
  16. data/lib/switchman/active_record/calculations.rb +74 -67
  17. data/lib/switchman/active_record/connection_pool.rb +14 -43
  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 -5
  22. data/lib/switchman/active_record/migration.rb +7 -51
  23. data/lib/switchman/active_record/model_schema.rb +1 -1
  24. data/lib/switchman/active_record/persistence.rb +3 -14
  25. data/lib/switchman/active_record/postgresql_adapter.rb +125 -169
  26. data/lib/switchman/active_record/predicate_builder.rb +2 -2
  27. data/lib/switchman/active_record/query_cache.rb +18 -19
  28. data/lib/switchman/active_record/query_methods.rb +168 -216
  29. data/lib/switchman/active_record/reflection.rb +7 -22
  30. data/lib/switchman/active_record/relation.rb +30 -78
  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_support/cache.rb +3 -5
  35. data/lib/switchman/arel.rb +13 -8
  36. data/lib/switchman/database_server.rb +121 -142
  37. data/lib/switchman/default_shard.rb +52 -16
  38. data/lib/switchman/engine.rb +62 -59
  39. data/lib/switchman/environment.rb +4 -8
  40. data/lib/switchman/errors.rb +1 -0
  41. data/lib/switchman/guard_rail/relation.rb +5 -7
  42. data/lib/switchman/guard_rail.rb +6 -19
  43. data/lib/switchman/r_spec_helper.rb +29 -37
  44. data/lib/switchman/rails.rb +14 -12
  45. data/lib/switchman/schema_cache.rb +1 -9
  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 +6 -4
  49. data/lib/switchman/version.rb +1 -1
  50. data/lib/switchman.rb +3 -5
  51. data/lib/tasks/switchman.rake +55 -71
  52. metadata +88 -46
  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
@@ -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,30 +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
- # we still pass through both of these options for back-compat purposes
50
- { parallel: ENV['PARALLEL']&.to_i, max_procs: ENV['MAX_PARALLEL_PROCS']&.to_i }
49
+ { parallel: ENV['PARALLEL'].to_i, max_procs: ENV['MAX_PARALLEL_PROCS'] }
51
50
  end
52
51
 
53
- # 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
54
53
  # task. tasks which modify the schema may want to pass all categories in
55
54
  # so that schema updates for non-default tables happen against all shards.
56
55
  # this is handled automatically for the default migration tasks, below.
57
- def self.shardify_task(task_name, categories: [:primary])
56
+ def self.shardify_task(task_name, classes: [::ActiveRecord::Base])
58
57
  old_task = ::Rake::Task[task_name]
59
58
  old_actions = old_task.actions.dup
60
59
  old_task.actions.clear
@@ -67,43 +66,30 @@ module Switchman
67
66
 
68
67
  ::GuardRail.activate(:deploy) do
69
68
  Shard.default.database_server.unguard do
70
- begin
71
- categories = categories.call if categories.respond_to?(:call)
72
- Shard.with_each_shard(scope, categories, options) do
73
- shard = Shard.current
74
- puts "#{shard.id}: #{shard.description}"
75
- ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
76
- if ::Rails.version < '6.0'
77
- ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
78
- else
79
- # Adopted from the deprecated code that currently lives in rails proper
80
- remaining_configs = ::ActiveRecord::Base.configurations.configurations.reject { |db_config| db_config.env_name == ::Rails.env }
81
- new_config = ::ActiveRecord::DatabaseConfigurations.new(::Rails.env =>
82
- ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys).configurations
83
- new_configs = remaining_configs + new_config
84
-
85
- ::ActiveRecord::Base.configurations = new_configs
86
- end
87
- shard.database_server.unguard do
88
- old_actions.each { |action| action.call(*task_args) }
89
- end
90
- 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) }
91
76
  end
92
- rescue => e
93
- puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel].to_i != 0
94
- raise
77
+ nil
95
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
96
84
  end
97
85
  end
98
86
  end
99
87
  end
100
88
 
101
- %w{db:migrate db:migrate:up db:migrate:down db:rollback}.each do |task_name|
102
- 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, classes: -> { Shard.sharded_models })
103
91
  end
104
92
 
105
- private
106
-
107
93
  def self.shard_scope(scope, raw_shard_ids)
108
94
  raw_shard_ids = raw_shard_ids.split(',')
109
95
 
@@ -126,6 +112,7 @@ module Switchman
126
112
  when /^(-?)(\d+)?\.\.(\.)?(\d+)?$/
127
113
  negative, start, open, finish = $1.present?, $2, $3.present?, $4
128
114
  raise "Invalid shard id or range: #{id}" unless start || finish
115
+
129
116
  range = []
130
117
  range << "id>=#{start}" if start
131
118
  range << "id<#{'=' unless open}#{finish}" if finish
@@ -137,12 +124,12 @@ module Switchman
137
124
  when %r{^(-?\d+)/(\d+)$}
138
125
  numerator = $1.to_i
139
126
  denominator = $2.to_i
140
- if numerator == 0 || numerator.abs > denominator
141
- raise "Invalid fractional chunk: #{id}"
142
- end
127
+ raise "Invalid fractional chunk: #{id}" if numerator.zero? || numerator.abs > denominator
128
+
143
129
  # one chunk means everything
144
130
  if denominator == 1
145
131
  next if numerator == 1
132
+
146
133
  return scope.none
147
134
  end
148
135
 
@@ -157,24 +144,25 @@ module Switchman
157
144
  select = []
158
145
  if index != 1
159
146
  subscope = subscope.offset(per_chunk * (index - 1))
160
- select << "MIN(id) AS min_id"
147
+ select << 'MIN(id) AS min_id'
161
148
  end
162
149
  if index != denominator
163
150
  subscope = subscope.limit(per_chunk)
164
- select << "MAX(id) AS max_id"
165
- end
166
-
167
- result = Shard.from(subscope).select(select.join(", ")).to_a.first
168
- if index == 1
169
- range = "id<=#{result['max_id']}"
170
- elsif index == denominator
171
- range = "id>=#{result['min_id']}"
172
- else
173
- range = "(id>=#{result['min_id']} AND id<=#{result['max_id']})"
151
+ select << 'MAX(id) AS max_id'
174
152
  end
175
153
 
176
- (numerator < 0 ? negative_ranges : ranges) << range
177
- 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
178
166
  raise "Invalid shard id or range: #{id}"
179
167
  end
180
168
  end
@@ -183,27 +171,24 @@ module Switchman
183
171
  negative_shard_ids.uniq!
184
172
  unless shard_ids.empty?
185
173
  shard_ids -= negative_shard_ids
186
- if shard_ids.empty? && ranges.empty?
187
- return scope.none
188
- end
174
+ return scope.none if shard_ids.empty? && ranges.empty?
175
+
189
176
  # we already trimmed them all out; no need to make the server do it as well
190
177
  negative_shard_ids = [] if ranges.empty?
191
178
  end
192
179
 
193
180
  conditions = []
194
181
  positive_queries = []
195
- unless ranges.empty?
196
- positive_queries << ranges.join(" OR ")
197
- end
182
+ positive_queries << ranges.join(' OR ') unless ranges.empty?
198
183
  unless shard_ids.empty?
199
- positive_queries << "id IN (?)"
184
+ positive_queries << 'id IN (?)'
200
185
  conditions << shard_ids
201
186
  end
202
- positive_query = positive_queries.join(" OR ")
187
+ positive_query = positive_queries.join(' OR ')
203
188
  scope = scope.where(positive_query, *conditions) unless positive_queries.empty?
204
189
 
205
- scope = scope.where("NOT (#{negative_ranges.join(" OR")})") unless negative_ranges.empty?
206
- 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?
207
192
  scope
208
193
  end
209
194
 
@@ -214,18 +199,17 @@ module Switchman
214
199
 
215
200
  module ActiveRecord
216
201
  module PostgreSQLDatabaseTasks
217
- def structure_dump(filename, extra_flags=nil)
202
+ def structure_dump(filename, extra_flags = nil)
218
203
  set_psql_env
219
204
  args = ['-s', '-x', '-O', '-f', filename]
220
205
  args.concat(Array(extra_flags)) if extra_flags
221
- search_path = configuration['schema_search_path']
222
206
  shard = Shard.current.name
223
207
  serialized_search_path = shard
224
208
  args << "--schema=#{Shellwords.escape(shard)}"
225
209
 
226
210
  args << configuration['database']
227
211
  run_cmd('pg_dump', args, 'dumping')
228
- File.open(filename, "a") { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
212
+ File.open(filename, 'a') { |f| f << "SET search_path TO #{serialized_search_path};\n\n" }
229
213
  end
230
214
  end
231
215
  end
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
8
8
  - James Williams
9
9
  - Jacob Fugal
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-03-09 00:00:00.000000000 Z
13
+ date: 2021-03-17 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.2'
21
+ version: '6.1'
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.2'
31
+ version: '6.1'
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.2'
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.2'
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
@@ -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
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
199
  - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: '12.0'
201
+ version: '0.5'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
206
  - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: '12.0'
208
+ version: '0.5'
209
+ - !ruby/object:Gem::Dependency
210
+ name: rubocop-rspec
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - "~>"
214
+ - !ruby/object:Gem::Version
215
+ version: '2.2'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - "~>"
221
+ - !ruby/object:Gem::Version
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,11 @@ 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
234
278
  - lib/switchman/active_record/type_caster.rb
235
- - lib/switchman/active_record/where_clause_factory.rb
236
279
  - lib/switchman/active_support/cache.rb
237
280
  - lib/switchman/arel.rb
238
281
  - lib/switchman/call_super.rb
239
- - lib/switchman/connection_pool_proxy.rb
240
282
  - lib/switchman/database_server.rb
241
283
  - lib/switchman/default_shard.rb
242
284
  - lib/switchman/engine.rb
@@ -257,7 +299,7 @@ homepage: http://www.instructure.com/
257
299
  licenses:
258
300
  - MIT
259
301
  metadata: {}
260
- post_install_message:
302
+ post_install_message:
261
303
  rdoc_options: []
262
304
  require_paths:
263
305
  - lib
@@ -273,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
315
  version: '0'
274
316
  requirements: []
275
317
  rubygems_version: 3.1.4
276
- signing_key:
318
+ signing_key:
277
319
  specification_version: 4
278
320
  summary: Rails sharding magic
279
321
  test_files: []
@@ -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