activerecord-multi-tenant 2.0.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/active-record-multi-tenant-tests.yml +83 -0
- data/.gitignore +6 -0
- data/.readthedocs.yaml +15 -0
- data/.rspec +0 -0
- data/.rubocop.yml +51 -0
- data/Appraisals +6 -22
- data/CHANGELOG.md +42 -0
- data/Gemfile +3 -1
- data/LICENSE +0 -0
- data/README.md +3 -2
- data/Rakefile +1 -1
- data/activerecord-multi-tenant.gemspec +28 -22
- data/docker-compose.yml +24 -18
- data/docs/.gitignore +3 -0
- data/docs/Makefile +28 -0
- data/docs/api-reference.sh +10 -0
- data/docs/requirements.in +4 -0
- data/docs/requirements.txt +62 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations/Association.html +285 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations/ClassMethods.html +255 -0
- data/docs/source/_static/api-reference/ActiveRecord/Associations.html +117 -0
- data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters/SchemaStatements.html +232 -0
- data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters.html +126 -0
- data/docs/source/_static/api-reference/ActiveRecord/QueryMethods.html +336 -0
- data/docs/source/_static/api-reference/ActiveRecord/SchemaDumper.html +121 -0
- data/docs/source/_static/api-reference/ActiveRecord.html +130 -0
- data/docs/source/_static/api-reference/MultiTenant/ArelTenantVisitor.html +755 -0
- data/docs/source/_static/api-reference/MultiTenant/ArelVisitorsDepthFirst.html +208 -0
- data/docs/source/_static/api-reference/MultiTenant/BaseTenantEnforcementClause.html +462 -0
- data/docs/source/_static/api-reference/MultiTenant/Context.html +659 -0
- data/docs/source/_static/api-reference/MultiTenant/ControllerExtensions.html +202 -0
- data/docs/source/_static/api-reference/MultiTenant/CopyFromClient.html +186 -0
- data/docs/source/_static/api-reference/MultiTenant/CopyFromClientHelper.html +362 -0
- data/docs/source/_static/api-reference/MultiTenant/Current.html +124 -0
- data/docs/source/_static/api-reference/MultiTenant/DatabaseStatements.html +366 -0
- data/docs/source/_static/api-reference/MultiTenant/FastTruncate.html +226 -0
- data/docs/source/_static/api-reference/MultiTenant/MigrationExtensions.html +554 -0
- data/docs/source/_static/api-reference/MultiTenant/MissingTenantError.html +124 -0
- data/docs/source/_static/api-reference/MultiTenant/ModelExtensionsClassMethods.html +492 -0
- data/docs/source/_static/api-reference/MultiTenant/QueryMonitor.html +257 -0
- data/docs/source/_static/api-reference/MultiTenant/Table.html +419 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantEnforcementClause.html +148 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantIsImmutable.html +135 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantJoinEnforcementClause.html +310 -0
- data/docs/source/_static/api-reference/MultiTenant/TenantValueVisitor.html +239 -0
- data/docs/source/_static/api-reference/MultiTenant.html +1454 -0
- data/docs/source/_static/api-reference/MultiTenantFindBy.html +180 -0
- data/docs/source/_static/api-reference/Sidekiq/Client.html +302 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Client.html +217 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Server.html +219 -0
- data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant.html +126 -0
- data/docs/source/_static/api-reference/Sidekiq.html +126 -0
- data/docs/source/_static/api-reference/_index.html +399 -0
- data/docs/source/_static/api-reference/class_list.html +51 -0
- data/docs/source/_static/api-reference/css/common.css +1 -0
- data/docs/source/_static/api-reference/css/full_list.css +58 -0
- data/docs/source/_static/api-reference/css/style.css +497 -0
- data/docs/source/_static/api-reference/file.README.html +167 -0
- data/docs/source/_static/api-reference/file_list.html +56 -0
- data/docs/source/_static/api-reference/frames.html +17 -0
- data/docs/source/_static/api-reference/index.html +167 -0
- data/docs/source/_static/api-reference/js/app.js +314 -0
- data/docs/source/_static/api-reference/js/full_list.js +216 -0
- data/docs/source/_static/api-reference/js/jquery.js +4 -0
- data/docs/source/_static/api-reference/method_list.html +715 -0
- data/docs/source/_static/api-reference/top-level-namespace.html +126 -0
- data/docs/source/_templates/.gitignore +4 -0
- data/docs/source/api-reference.rst +8 -0
- data/docs/source/appendix.rst +26 -0
- data/docs/source/changelog.rst +8 -0
- data/docs/source/community-and-support.rst +26 -0
- data/docs/source/conf.py +30 -0
- data/docs/source/contributing.rst +70 -0
- data/docs/source/getting-started.rst +37 -0
- data/docs/source/guides-and-tutorials.rst +129 -0
- data/docs/source/index.rst +54 -0
- data/docs/source/introduction.rst +33 -0
- data/docs/source/license.rst +22 -0
- data/docs/source/troubleshooting.rst +41 -0
- data/docs/source/usage-guide.rst +59 -0
- data/lib/activerecord-multi-tenant/arel_visitors_depth_first.rb +183 -174
- data/lib/activerecord-multi-tenant/controller_extensions.rb +15 -4
- data/lib/activerecord-multi-tenant/copy_from_client.rb +4 -0
- data/lib/activerecord-multi-tenant/fast_truncate.rb +4 -2
- data/lib/activerecord-multi-tenant/habtm.rb +50 -0
- data/lib/activerecord-multi-tenant/migrations.rb +87 -10
- data/lib/activerecord-multi-tenant/model_extensions.rb +96 -38
- data/lib/activerecord-multi-tenant/multi_tenant.rb +83 -24
- data/lib/activerecord-multi-tenant/query_monitor.rb +21 -5
- data/lib/activerecord-multi-tenant/query_rewriter.rb +121 -87
- data/lib/activerecord-multi-tenant/sidekiq.rb +46 -19
- data/lib/activerecord-multi-tenant/table_node.rb +13 -0
- data/lib/activerecord-multi-tenant/version.rb +1 -1
- data/lib/activerecord-multi-tenant.rb +3 -13
- data/lib/activerecord_multi_tenant.rb +13 -0
- data/spec/activerecord-multi-tenant/associations_spec.rb +42 -0
- data/spec/activerecord-multi-tenant/controller_extensions_spec.rb +3 -2
- data/spec/activerecord-multi-tenant/fast_truncate_spec.rb +8 -6
- data/spec/activerecord-multi-tenant/model_extensions_spec.rb +300 -147
- data/spec/activerecord-multi-tenant/multi_tenant_spec.rb +69 -13
- data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +60 -59
- data/spec/activerecord-multi-tenant/record_callback_spec.rb +0 -0
- data/spec/activerecord-multi-tenant/record_finding_spec.rb +11 -11
- data/spec/activerecord-multi-tenant/record_modifications_spec.rb +23 -4
- data/spec/activerecord-multi-tenant/sidekiq_spec.rb +10 -10
- data/spec/database.yml +0 -0
- data/spec/schema.rb +20 -3
- data/spec/spec_helper.rb +46 -17
- data/spec/support/format_sql.rb +20 -0
- metadata +134 -32
- data/.github/workflows/CI.yml +0 -73
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/active_record_5.2.3.gemfile +0 -16
- data/gemfiles/active_record_5.2.gemfile +0 -16
- data/gemfiles/active_record_6.0.gemfile +0 -8
- data/gemfiles/active_record_6.1.gemfile +0 -8
- data/gemfiles/active_record_7.0.gemfile +0 -8
- data/gemfiles/rails_5.2.3.gemfile +0 -16
- data/gemfiles/rails_5.2.gemfile +0 -16
- data/gemfiles/rails_6.0.gemfile +0 -8
- data/gemfiles/rails_6.1.gemfile +0 -8
- data/gemfiles/rails_7.0.gemfile +0 -8
- data/lib/activerecord-multi-tenant/persistence_extension.rb +0 -13
- data/lib/activerecord-multi-tenant/with_lock.rb +0 -15
- data/spec/activerecord-multi-tenant/schema_dumper_tester.rb +0 -0
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-multi-tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Citus Data
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,30 +16,30 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: anbt-sql-formatter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: codecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry-byebug
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rake
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +109,21 @@ dependencies:
|
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec-rails
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
129
|
- - ">="
|
@@ -95,7 +137,7 @@ dependencies:
|
|
95
137
|
- !ruby/object:Gem::Version
|
96
138
|
version: '0'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
140
|
+
name: rubocop
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
100
142
|
requirements:
|
101
143
|
- - ">="
|
@@ -109,7 +151,7 @@ dependencies:
|
|
109
151
|
- !ruby/object:Gem::Version
|
110
152
|
version: '0'
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
154
|
+
name: sidekiq
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
114
156
|
requirements:
|
115
157
|
- - ">="
|
@@ -123,7 +165,7 @@ dependencies:
|
|
123
165
|
- !ruby/object:Gem::Version
|
124
166
|
version: '0'
|
125
167
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
168
|
+
name: thor
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
128
170
|
requirements:
|
129
171
|
- - ">="
|
@@ -142,9 +184,11 @@ executables: []
|
|
142
184
|
extensions: []
|
143
185
|
extra_rdoc_files: []
|
144
186
|
files:
|
145
|
-
- ".github/workflows/
|
187
|
+
- ".github/workflows/active-record-multi-tenant-tests.yml"
|
146
188
|
- ".gitignore"
|
189
|
+
- ".readthedocs.yaml"
|
147
190
|
- ".rspec"
|
191
|
+
- ".rubocop.yml"
|
148
192
|
- Appraisals
|
149
193
|
- CHANGELOG.md
|
150
194
|
- Gemfile
|
@@ -153,31 +197,89 @@ files:
|
|
153
197
|
- Rakefile
|
154
198
|
- activerecord-multi-tenant.gemspec
|
155
199
|
- docker-compose.yml
|
156
|
-
-
|
157
|
-
-
|
158
|
-
-
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
164
|
-
-
|
165
|
-
-
|
166
|
-
-
|
200
|
+
- docs/.gitignore
|
201
|
+
- docs/Makefile
|
202
|
+
- docs/api-reference.sh
|
203
|
+
- docs/requirements.in
|
204
|
+
- docs/requirements.txt
|
205
|
+
- docs/source/_static/api-reference/ActiveRecord.html
|
206
|
+
- docs/source/_static/api-reference/ActiveRecord/Associations.html
|
207
|
+
- docs/source/_static/api-reference/ActiveRecord/Associations/Association.html
|
208
|
+
- docs/source/_static/api-reference/ActiveRecord/Associations/ClassMethods.html
|
209
|
+
- docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters.html
|
210
|
+
- docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters/SchemaStatements.html
|
211
|
+
- docs/source/_static/api-reference/ActiveRecord/QueryMethods.html
|
212
|
+
- docs/source/_static/api-reference/ActiveRecord/SchemaDumper.html
|
213
|
+
- docs/source/_static/api-reference/MultiTenant.html
|
214
|
+
- docs/source/_static/api-reference/MultiTenant/ArelTenantVisitor.html
|
215
|
+
- docs/source/_static/api-reference/MultiTenant/ArelVisitorsDepthFirst.html
|
216
|
+
- docs/source/_static/api-reference/MultiTenant/BaseTenantEnforcementClause.html
|
217
|
+
- docs/source/_static/api-reference/MultiTenant/Context.html
|
218
|
+
- docs/source/_static/api-reference/MultiTenant/ControllerExtensions.html
|
219
|
+
- docs/source/_static/api-reference/MultiTenant/CopyFromClient.html
|
220
|
+
- docs/source/_static/api-reference/MultiTenant/CopyFromClientHelper.html
|
221
|
+
- docs/source/_static/api-reference/MultiTenant/Current.html
|
222
|
+
- docs/source/_static/api-reference/MultiTenant/DatabaseStatements.html
|
223
|
+
- docs/source/_static/api-reference/MultiTenant/FastTruncate.html
|
224
|
+
- docs/source/_static/api-reference/MultiTenant/MigrationExtensions.html
|
225
|
+
- docs/source/_static/api-reference/MultiTenant/MissingTenantError.html
|
226
|
+
- docs/source/_static/api-reference/MultiTenant/ModelExtensionsClassMethods.html
|
227
|
+
- docs/source/_static/api-reference/MultiTenant/QueryMonitor.html
|
228
|
+
- docs/source/_static/api-reference/MultiTenant/Table.html
|
229
|
+
- docs/source/_static/api-reference/MultiTenant/TenantEnforcementClause.html
|
230
|
+
- docs/source/_static/api-reference/MultiTenant/TenantIsImmutable.html
|
231
|
+
- docs/source/_static/api-reference/MultiTenant/TenantJoinEnforcementClause.html
|
232
|
+
- docs/source/_static/api-reference/MultiTenant/TenantValueVisitor.html
|
233
|
+
- docs/source/_static/api-reference/MultiTenantFindBy.html
|
234
|
+
- docs/source/_static/api-reference/Sidekiq.html
|
235
|
+
- docs/source/_static/api-reference/Sidekiq/Client.html
|
236
|
+
- docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant.html
|
237
|
+
- docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Client.html
|
238
|
+
- docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Server.html
|
239
|
+
- docs/source/_static/api-reference/_index.html
|
240
|
+
- docs/source/_static/api-reference/class_list.html
|
241
|
+
- docs/source/_static/api-reference/css/common.css
|
242
|
+
- docs/source/_static/api-reference/css/full_list.css
|
243
|
+
- docs/source/_static/api-reference/css/style.css
|
244
|
+
- docs/source/_static/api-reference/file.README.html
|
245
|
+
- docs/source/_static/api-reference/file_list.html
|
246
|
+
- docs/source/_static/api-reference/frames.html
|
247
|
+
- docs/source/_static/api-reference/index.html
|
248
|
+
- docs/source/_static/api-reference/js/app.js
|
249
|
+
- docs/source/_static/api-reference/js/full_list.js
|
250
|
+
- docs/source/_static/api-reference/js/jquery.js
|
251
|
+
- docs/source/_static/api-reference/method_list.html
|
252
|
+
- docs/source/_static/api-reference/top-level-namespace.html
|
253
|
+
- docs/source/_templates/.gitignore
|
254
|
+
- docs/source/api-reference.rst
|
255
|
+
- docs/source/appendix.rst
|
256
|
+
- docs/source/changelog.rst
|
257
|
+
- docs/source/community-and-support.rst
|
258
|
+
- docs/source/conf.py
|
259
|
+
- docs/source/contributing.rst
|
260
|
+
- docs/source/getting-started.rst
|
261
|
+
- docs/source/guides-and-tutorials.rst
|
262
|
+
- docs/source/index.rst
|
263
|
+
- docs/source/introduction.rst
|
264
|
+
- docs/source/license.rst
|
265
|
+
- docs/source/troubleshooting.rst
|
266
|
+
- docs/source/usage-guide.rst
|
167
267
|
- lib/activerecord-multi-tenant.rb
|
168
268
|
- lib/activerecord-multi-tenant/arel_visitors_depth_first.rb
|
169
269
|
- lib/activerecord-multi-tenant/controller_extensions.rb
|
170
270
|
- lib/activerecord-multi-tenant/copy_from_client.rb
|
171
271
|
- lib/activerecord-multi-tenant/fast_truncate.rb
|
272
|
+
- lib/activerecord-multi-tenant/habtm.rb
|
172
273
|
- lib/activerecord-multi-tenant/migrations.rb
|
173
274
|
- lib/activerecord-multi-tenant/model_extensions.rb
|
174
275
|
- lib/activerecord-multi-tenant/multi_tenant.rb
|
175
|
-
- lib/activerecord-multi-tenant/persistence_extension.rb
|
176
276
|
- lib/activerecord-multi-tenant/query_monitor.rb
|
177
277
|
- lib/activerecord-multi-tenant/query_rewriter.rb
|
178
278
|
- lib/activerecord-multi-tenant/sidekiq.rb
|
279
|
+
- lib/activerecord-multi-tenant/table_node.rb
|
179
280
|
- lib/activerecord-multi-tenant/version.rb
|
180
|
-
- lib/
|
281
|
+
- lib/activerecord_multi_tenant.rb
|
282
|
+
- spec/activerecord-multi-tenant/associations_spec.rb
|
181
283
|
- spec/activerecord-multi-tenant/controller_extensions_spec.rb
|
182
284
|
- spec/activerecord-multi-tenant/fast_truncate_spec.rb
|
183
285
|
- spec/activerecord-multi-tenant/model_extensions_spec.rb
|
@@ -186,16 +288,16 @@ files:
|
|
186
288
|
- spec/activerecord-multi-tenant/record_callback_spec.rb
|
187
289
|
- spec/activerecord-multi-tenant/record_finding_spec.rb
|
188
290
|
- spec/activerecord-multi-tenant/record_modifications_spec.rb
|
189
|
-
- spec/activerecord-multi-tenant/schema_dumper_tester.rb
|
190
291
|
- spec/activerecord-multi-tenant/sidekiq_spec.rb
|
191
292
|
- spec/database.yml
|
192
293
|
- spec/schema.rb
|
193
294
|
- spec/spec_helper.rb
|
295
|
+
- spec/support/format_sql.rb
|
194
296
|
homepage: https://github.com/citusdata/activerecord-multi-tenant
|
195
297
|
licenses:
|
196
298
|
- MIT
|
197
299
|
metadata: {}
|
198
|
-
post_install_message:
|
300
|
+
post_install_message:
|
199
301
|
rdoc_options: []
|
200
302
|
require_paths:
|
201
303
|
- lib
|
@@ -203,15 +305,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
305
|
requirements:
|
204
306
|
- - ">="
|
205
307
|
- !ruby/object:Gem::Version
|
206
|
-
version:
|
308
|
+
version: 3.0.0
|
207
309
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
310
|
requirements:
|
209
311
|
- - ">="
|
210
312
|
- !ruby/object:Gem::Version
|
211
313
|
version: '0'
|
212
314
|
requirements: []
|
213
|
-
rubygems_version: 3.
|
214
|
-
signing_key:
|
315
|
+
rubygems_version: 3.4.13
|
316
|
+
signing_key:
|
215
317
|
specification_version: 4
|
216
318
|
summary: ActiveRecord/Rails integration for multi-tenant databases, in particular
|
217
319
|
the Citus extension for PostgreSQL
|
data/.github/workflows/CI.yml
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
pull_request:
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
build:
|
11
|
-
runs-on: ubuntu-latest
|
12
|
-
strategy:
|
13
|
-
fail-fast: false
|
14
|
-
matrix:
|
15
|
-
ruby:
|
16
|
-
- '2.5'
|
17
|
-
- '2.6'
|
18
|
-
- '2.7'
|
19
|
-
- '3.0'
|
20
|
-
- '3.1'
|
21
|
-
gemfile:
|
22
|
-
- rails_5.2.3
|
23
|
-
- rails_5.2
|
24
|
-
- rails_6.0
|
25
|
-
- rails_6.1
|
26
|
-
- rails_7.0
|
27
|
-
- active_record_5.2.3
|
28
|
-
- active_record_5.2
|
29
|
-
- active_record_6.0
|
30
|
-
- active_record_6.1
|
31
|
-
- active_record_7.0
|
32
|
-
prepared_statements: [true, false]
|
33
|
-
exclude:
|
34
|
-
# activesupport-7.0.0 requires ruby version >= 2.7.0
|
35
|
-
- ruby: '2.5'
|
36
|
-
gemfile: 'rails_7.0'
|
37
|
-
- ruby: '2.5'
|
38
|
-
gemfile: 'active_record_7.0'
|
39
|
-
- ruby: '2.6'
|
40
|
-
gemfile: 'rails_7.0'
|
41
|
-
- ruby: '2.6'
|
42
|
-
gemfile: 'active_record_7.0'
|
43
|
-
# ruby >3 and activesupport 5.2 are not compatible
|
44
|
-
- ruby: '3.0'
|
45
|
-
gemfile: 'rails_5.2'
|
46
|
-
- ruby: '3.0'
|
47
|
-
gemfile: 'active_record_5.2'
|
48
|
-
- ruby: '3.1'
|
49
|
-
gemfile: 'rails_5.2'
|
50
|
-
- ruby: '3.1'
|
51
|
-
gemfile: 'active_record_5.2'
|
52
|
-
- ruby: '3.0'
|
53
|
-
gemfile: 'rails_5.2.3'
|
54
|
-
- ruby: '3.0'
|
55
|
-
gemfile: 'active_record_5.2.3'
|
56
|
-
- ruby: '3.1'
|
57
|
-
gemfile: 'rails_5.2.3'
|
58
|
-
- ruby: '3.1'
|
59
|
-
gemfile: 'active_record_5.2.3'
|
60
|
-
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }} ${{ (matrix.prepared_statements && 'w/ prepared statements') || '' }}
|
61
|
-
env:
|
62
|
-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
63
|
-
PREPARED_STATEMENTS: ${{ matrix.prepared_statements && '1' }}
|
64
|
-
steps:
|
65
|
-
- uses: actions/checkout@v2
|
66
|
-
- run: |
|
67
|
-
docker-compose up -d
|
68
|
-
- uses: ruby/setup-ruby@v1
|
69
|
-
with:
|
70
|
-
ruby-version: ${{ matrix.ruby }}
|
71
|
-
bundler-cache: true
|
72
|
-
- run: |
|
73
|
-
bundle exec rake spec
|
data/gemfiles/.bundle/config
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "activerecord", "~> 5.2.0", "< 5.2.4" # FIXME
|
7
|
-
gem "i18n", "~> 0.9.5"
|
8
|
-
gem "nokogiri", "~> 1.7.1"
|
9
|
-
gem "nio4r", "~> 2.3.1"
|
10
|
-
gem "sprockets", "~> 3.7.1"
|
11
|
-
gem "byebug", "~> 11.0"
|
12
|
-
gem "rake", "12.0.0"
|
13
|
-
gem "redis", "3.3.3"
|
14
|
-
gem "pry-byebug", "3.9.0"
|
15
|
-
|
16
|
-
gemspec path: "../"
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "activerecord", "~> 5.2.0"
|
7
|
-
gem "i18n", "~> 0.9.5"
|
8
|
-
gem "nokogiri", "~> 1.7.1"
|
9
|
-
gem "nio4r", "~> 2.3.1"
|
10
|
-
gem "sprockets", "~> 3.7.1"
|
11
|
-
gem "byebug", "~> 11.0"
|
12
|
-
gem "rake", "12.0.0"
|
13
|
-
gem "redis", "3.3.3"
|
14
|
-
gem "pry-byebug", "3.9.0"
|
15
|
-
|
16
|
-
gemspec path: "../"
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "rails", "~> 5.2.0", "< 5.2.4" # FIXME
|
7
|
-
gem "i18n", "~> 0.9.5"
|
8
|
-
gem "nokogiri", "~> 1.7.1"
|
9
|
-
gem "nio4r", "~> 2.3.1"
|
10
|
-
gem "sprockets", "~> 3.7.1"
|
11
|
-
gem "byebug", "~> 11.0"
|
12
|
-
gem "rake", "12.0.0"
|
13
|
-
gem "redis", "3.3.3"
|
14
|
-
gem "pry-byebug", "3.9.0"
|
15
|
-
|
16
|
-
gemspec path: "../"
|
data/gemfiles/rails_5.2.gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "rails", "~> 5.2.0"
|
7
|
-
gem "i18n", "~> 0.9.5"
|
8
|
-
gem "nokogiri", "~> 1.7.1"
|
9
|
-
gem "nio4r", "~> 2.3.1"
|
10
|
-
gem "sprockets", "~> 3.7.1"
|
11
|
-
gem "byebug", "~> 11.0"
|
12
|
-
gem "rake", "12.0.0"
|
13
|
-
gem "redis", "3.3.3"
|
14
|
-
gem "pry-byebug", "3.9.0"
|
15
|
-
|
16
|
-
gemspec path: "../"
|
data/gemfiles/rails_6.0.gemfile
DELETED
data/gemfiles/rails_6.1.gemfile
DELETED
data/gemfiles/rails_7.0.gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module ActiveRecord
|
2
|
-
module Persistence
|
3
|
-
alias :delete_orig :delete
|
4
|
-
|
5
|
-
def delete
|
6
|
-
if MultiTenant.multi_tenant_model_for_table(self.class.table_name).present? && persisted? && MultiTenant.current_tenant_id.nil?
|
7
|
-
MultiTenant.with(self.public_send(self.class.partition_key)) { delete_orig }
|
8
|
-
else
|
9
|
-
delete_orig
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Workaround for https://github.com/citusdata/citus/issues/1236
|
2
|
-
# "SELECT ... FOR UPDATE is not supported for router-plannable queries"
|
3
|
-
|
4
|
-
class ActiveRecord::Base
|
5
|
-
alias :lock_orig :lock!
|
6
|
-
def lock!(lock = true)
|
7
|
-
if lock && persisted? && self.class.respond_to?(:scoped_by_tenant?) && MultiTenant.current_tenant_id && MultiTenant.with_lock_workaround_enabled?
|
8
|
-
self.class.unscoped.where(id: id).update_all(id: id) # No-op UPDATE that locks the row
|
9
|
-
reload # This is just to act similar to the default ActiveRecord approach, in case someone relies on the reload
|
10
|
-
self
|
11
|
-
else
|
12
|
-
lock_orig(lock)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
File without changes
|