activerecord-multi-tenant 1.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/CI.yml +47 -0
  3. data/.gitignore +2 -0
  4. data/.rspec +1 -0
  5. data/Appraisals +6 -22
  6. data/CHANGELOG.md +46 -0
  7. data/README.md +1 -1
  8. data/activerecord-multi-tenant.gemspec +1 -2
  9. data/gemfiles/active_record_7.0.gemfile +8 -0
  10. data/gemfiles/rails_7.0.gemfile +8 -0
  11. data/lib/activerecord-multi-tenant/copy_from_client.rb +2 -2
  12. data/lib/activerecord-multi-tenant/migrations.rb +76 -9
  13. data/lib/activerecord-multi-tenant/model_extensions.rb +31 -8
  14. data/lib/activerecord-multi-tenant/multi_tenant.rb +57 -8
  15. data/lib/activerecord-multi-tenant/query_rewriter.rb +15 -11
  16. data/lib/activerecord-multi-tenant/sidekiq.rb +21 -1
  17. data/lib/activerecord-multi-tenant/version.rb +1 -1
  18. data/lib/activerecord-multi-tenant.rb +0 -1
  19. data/spec/activerecord-multi-tenant/associations_spec.rb +21 -0
  20. data/spec/activerecord-multi-tenant/model_extensions_spec.rb +186 -54
  21. data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +17 -0
  22. data/spec/activerecord-multi-tenant/record_modifications_spec.rb +19 -0
  23. data/spec/activerecord-multi-tenant/sidekiq_spec.rb +11 -0
  24. data/spec/schema.rb +50 -4
  25. data/spec/spec_helper.rb +7 -0
  26. metadata +13 -33
  27. data/.travis.yml +0 -34
  28. data/Gemfile.lock +0 -199
  29. data/gemfiles/active_record_5.2.gemfile +0 -16
  30. data/gemfiles/active_record_5.2.gemfile.lock +0 -188
  31. data/gemfiles/active_record_6.0.gemfile.lock +0 -198
  32. data/gemfiles/active_record_6.1.gemfile.lock +0 -198
  33. data/gemfiles/rails_5.2.gemfile +0 -16
  34. data/gemfiles/rails_5.2.gemfile.lock +0 -188
  35. data/gemfiles/rails_6.0.gemfile.lock +0 -198
  36. data/gemfiles/rails_6.1.gemfile.lock +0 -198
  37. data/lib/activerecord-multi-tenant/persistence_extension.rb +0 -13
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-multi-tenant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.2.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: 2021-01-16 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: request_store
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 1.0.5
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 1.0.5
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rails
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '4.2'
19
+ version: '6'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '4.2'
26
+ version: '6'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rspec
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -156,30 +142,24 @@ executables: []
156
142
  extensions: []
157
143
  extra_rdoc_files: []
158
144
  files:
145
+ - ".github/workflows/CI.yml"
159
146
  - ".gitignore"
160
- - ".travis.yml"
147
+ - ".rspec"
161
148
  - Appraisals
162
149
  - CHANGELOG.md
163
150
  - Gemfile
164
- - Gemfile.lock
165
151
  - LICENSE
166
152
  - README.md
167
153
  - Rakefile
168
154
  - activerecord-multi-tenant.gemspec
169
155
  - docker-compose.yml
170
156
  - gemfiles/.bundle/config
171
- - gemfiles/active_record_5.2.gemfile
172
- - gemfiles/active_record_5.2.gemfile.lock
173
157
  - gemfiles/active_record_6.0.gemfile
174
- - gemfiles/active_record_6.0.gemfile.lock
175
158
  - gemfiles/active_record_6.1.gemfile
176
- - gemfiles/active_record_6.1.gemfile.lock
177
- - gemfiles/rails_5.2.gemfile
178
- - gemfiles/rails_5.2.gemfile.lock
159
+ - gemfiles/active_record_7.0.gemfile
179
160
  - gemfiles/rails_6.0.gemfile
180
- - gemfiles/rails_6.0.gemfile.lock
181
161
  - gemfiles/rails_6.1.gemfile
182
- - gemfiles/rails_6.1.gemfile.lock
162
+ - gemfiles/rails_7.0.gemfile
183
163
  - lib/activerecord-multi-tenant.rb
184
164
  - lib/activerecord-multi-tenant/arel_visitors_depth_first.rb
185
165
  - lib/activerecord-multi-tenant/controller_extensions.rb
@@ -188,12 +168,12 @@ files:
188
168
  - lib/activerecord-multi-tenant/migrations.rb
189
169
  - lib/activerecord-multi-tenant/model_extensions.rb
190
170
  - lib/activerecord-multi-tenant/multi_tenant.rb
191
- - lib/activerecord-multi-tenant/persistence_extension.rb
192
171
  - lib/activerecord-multi-tenant/query_monitor.rb
193
172
  - lib/activerecord-multi-tenant/query_rewriter.rb
194
173
  - lib/activerecord-multi-tenant/sidekiq.rb
195
174
  - lib/activerecord-multi-tenant/version.rb
196
175
  - lib/activerecord-multi-tenant/with_lock.rb
176
+ - spec/activerecord-multi-tenant/associations_spec.rb
197
177
  - spec/activerecord-multi-tenant/controller_extensions_spec.rb
198
178
  - spec/activerecord-multi-tenant/fast_truncate_spec.rb
199
179
  - spec/activerecord-multi-tenant/model_extensions_spec.rb
@@ -211,7 +191,7 @@ homepage: https://github.com/citusdata/activerecord-multi-tenant
211
191
  licenses:
212
192
  - MIT
213
193
  metadata: {}
214
- post_install_message:
194
+ post_install_message:
215
195
  rdoc_options: []
216
196
  require_paths:
217
197
  - lib
@@ -226,8 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
206
  - !ruby/object:Gem::Version
227
207
  version: '0'
228
208
  requirements: []
229
- rubygems_version: 3.1.2
230
- signing_key:
209
+ rubygems_version: 3.2.32
210
+ signing_key:
231
211
  specification_version: 4
232
212
  summary: ActiveRecord/Rails integration for multi-tenant databases, in particular
233
213
  the Citus extension for PostgreSQL
data/.travis.yml DELETED
@@ -1,34 +0,0 @@
1
- sudo: required
2
- cache: bundler
3
-
4
- language: ruby
5
-
6
- rvm:
7
- - 2.5.8
8
- - 2.6.4
9
- - 2.7.1
10
-
11
- gemfile:
12
- - gemfiles/rails_5.2.gemfile
13
- - gemfiles/rails_6.0.gemfile
14
- - gemfiles/rails_6.1.gemfile
15
- - gemfiles/active_record_5.2.gemfile
16
- - gemfiles/active_record_6.0.gemfile
17
- - gemfiles/active_record_6.1.gemfile
18
-
19
- env:
20
- - PREPARED_STATEMENTS=0
21
- - PREPARED_STATEMENTS=1
22
-
23
- matrix:
24
- fast_finish: true
25
-
26
- services:
27
- - docker
28
-
29
- before_install:
30
- - docker-compose up -d
31
- - gem install bundler -v 2.1.4
32
-
33
- script:
34
- - bundle exec rake spec
data/Gemfile.lock DELETED
@@ -1,199 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- activerecord-multi-tenant (1.1.1)
5
- rails (>= 4.2)
6
- request_store (>= 1.0.5)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (6.0.3.3)
12
- actionpack (= 6.0.3.3)
13
- nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.3.3)
16
- actionpack (= 6.0.3.3)
17
- activejob (= 6.0.3.3)
18
- activerecord (= 6.0.3.3)
19
- activestorage (= 6.0.3.3)
20
- activesupport (= 6.0.3.3)
21
- mail (>= 2.7.1)
22
- actionmailer (6.0.3.3)
23
- actionpack (= 6.0.3.3)
24
- actionview (= 6.0.3.3)
25
- activejob (= 6.0.3.3)
26
- mail (~> 2.5, >= 2.5.4)
27
- rails-dom-testing (~> 2.0)
28
- actionpack (6.0.3.3)
29
- actionview (= 6.0.3.3)
30
- activesupport (= 6.0.3.3)
31
- rack (~> 2.0, >= 2.0.8)
32
- rack-test (>= 0.6.3)
33
- rails-dom-testing (~> 2.0)
34
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.3.3)
36
- actionpack (= 6.0.3.3)
37
- activerecord (= 6.0.3.3)
38
- activestorage (= 6.0.3.3)
39
- activesupport (= 6.0.3.3)
40
- nokogiri (>= 1.8.5)
41
- actionview (6.0.3.3)
42
- activesupport (= 6.0.3.3)
43
- builder (~> 3.1)
44
- erubi (~> 1.4)
45
- rails-dom-testing (~> 2.0)
46
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.3.3)
48
- activesupport (= 6.0.3.3)
49
- globalid (>= 0.3.6)
50
- activemodel (6.0.3.3)
51
- activesupport (= 6.0.3.3)
52
- activerecord (6.0.3.3)
53
- activemodel (= 6.0.3.3)
54
- activesupport (= 6.0.3.3)
55
- activestorage (6.0.3.3)
56
- actionpack (= 6.0.3.3)
57
- activejob (= 6.0.3.3)
58
- activerecord (= 6.0.3.3)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.3)
61
- concurrent-ruby (~> 1.0, >= 1.0.2)
62
- i18n (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- zeitwerk (~> 2.2, >= 2.2.2)
66
- appraisal (2.2.0)
67
- bundler
68
- rake
69
- thor (>= 0.14.0)
70
- builder (3.2.4)
71
- byebug (11.0.1)
72
- coderay (1.1.2)
73
- concurrent-ruby (1.1.7)
74
- connection_pool (2.2.2)
75
- crass (1.0.6)
76
- diff-lcs (1.3)
77
- erubi (1.9.0)
78
- globalid (0.4.2)
79
- activesupport (>= 4.2.0)
80
- i18n (1.8.5)
81
- concurrent-ruby (~> 1.0)
82
- loofah (2.7.0)
83
- crass (~> 1.0.2)
84
- nokogiri (>= 1.5.9)
85
- mail (2.7.1)
86
- mini_mime (>= 0.1.1)
87
- marcel (0.3.3)
88
- mimemagic (~> 0.3.2)
89
- method_source (0.9.2)
90
- mimemagic (0.3.5)
91
- mini_mime (1.0.2)
92
- mini_portile2 (2.5.0)
93
- minitest (5.14.2)
94
- nio4r (2.5.4)
95
- nokogiri (1.11.1)
96
- mini_portile2 (~> 2.5.0)
97
- racc (~> 1.4)
98
- pg (1.1.4)
99
- pry (0.12.2)
100
- coderay (~> 1.1.0)
101
- method_source (~> 0.9.0)
102
- pry-byebug (3.7.0)
103
- byebug (~> 11.0)
104
- pry (~> 0.10)
105
- racc (1.5.2)
106
- rack (2.2.3)
107
- rack-protection (2.0.5)
108
- rack
109
- rack-test (1.1.0)
110
- rack (>= 1.0, < 3)
111
- rails (6.0.3.3)
112
- actioncable (= 6.0.3.3)
113
- actionmailbox (= 6.0.3.3)
114
- actionmailer (= 6.0.3.3)
115
- actionpack (= 6.0.3.3)
116
- actiontext (= 6.0.3.3)
117
- actionview (= 6.0.3.3)
118
- activejob (= 6.0.3.3)
119
- activemodel (= 6.0.3.3)
120
- activerecord (= 6.0.3.3)
121
- activestorage (= 6.0.3.3)
122
- activesupport (= 6.0.3.3)
123
- bundler (>= 1.3.0)
124
- railties (= 6.0.3.3)
125
- sprockets-rails (>= 2.0.0)
126
- rails-dom-testing (2.0.3)
127
- activesupport (>= 4.2.0)
128
- nokogiri (>= 1.6)
129
- rails-html-sanitizer (1.3.0)
130
- loofah (~> 2.3)
131
- railties (6.0.3.3)
132
- actionpack (= 6.0.3.3)
133
- activesupport (= 6.0.3.3)
134
- method_source
135
- rake (>= 0.8.7)
136
- thor (>= 0.20.3, < 2.0)
137
- rake (13.0.1)
138
- redis (4.1.2)
139
- request_store (1.5.0)
140
- rack (>= 1.4)
141
- rspec (3.8.0)
142
- rspec-core (~> 3.8.0)
143
- rspec-expectations (~> 3.8.0)
144
- rspec-mocks (~> 3.8.0)
145
- rspec-core (3.8.2)
146
- rspec-support (~> 3.8.0)
147
- rspec-expectations (3.8.4)
148
- diff-lcs (>= 1.2.0, < 2.0)
149
- rspec-support (~> 3.8.0)
150
- rspec-mocks (3.8.1)
151
- diff-lcs (>= 1.2.0, < 2.0)
152
- rspec-support (~> 3.8.0)
153
- rspec-rails (3.8.2)
154
- actionpack (>= 3.0)
155
- activesupport (>= 3.0)
156
- railties (>= 3.0)
157
- rspec-core (~> 3.8.0)
158
- rspec-expectations (~> 3.8.0)
159
- rspec-mocks (~> 3.8.0)
160
- rspec-support (~> 3.8.0)
161
- rspec-support (3.8.2)
162
- sidekiq (5.2.7)
163
- connection_pool (~> 2.2, >= 2.2.2)
164
- rack (>= 1.5.0)
165
- rack-protection (>= 1.5.0)
166
- redis (>= 3.3.5, < 5)
167
- sprockets (4.0.2)
168
- concurrent-ruby (~> 1.0)
169
- rack (> 1, < 3)
170
- sprockets-rails (3.2.2)
171
- actionpack (>= 4.0)
172
- activesupport (>= 4.0)
173
- sprockets (>= 3.0.0)
174
- thor (0.20.3)
175
- thread_safe (0.3.6)
176
- tzinfo (1.2.7)
177
- thread_safe (~> 0.1)
178
- websocket-driver (0.7.3)
179
- websocket-extensions (>= 0.1.0)
180
- websocket-extensions (0.1.5)
181
- zeitwerk (2.4.0)
182
-
183
- PLATFORMS
184
- ruby
185
-
186
- DEPENDENCIES
187
- activerecord-multi-tenant!
188
- appraisal
189
- pg
190
- pry
191
- pry-byebug
192
- rake
193
- rspec (>= 3.0)
194
- rspec-rails
195
- sidekiq
196
- thor
197
-
198
- BUNDLED WITH
199
- 2.1.4
@@ -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,188 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- activerecord-multi-tenant (1.1.1)
5
- rails (>= 4.2)
6
- request_store (>= 1.0.5)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (5.2.3)
12
- actionpack (= 5.2.3)
13
- nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.3)
16
- actionpack (= 5.2.3)
17
- actionview (= 5.2.3)
18
- activejob (= 5.2.3)
19
- mail (~> 2.5, >= 2.5.4)
20
- rails-dom-testing (~> 2.0)
21
- actionpack (5.2.3)
22
- actionview (= 5.2.3)
23
- activesupport (= 5.2.3)
24
- rack (~> 2.0)
25
- rack-test (>= 0.6.3)
26
- rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.3)
29
- activesupport (= 5.2.3)
30
- builder (~> 3.1)
31
- erubi (~> 1.4)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.3)
35
- activesupport (= 5.2.3)
36
- globalid (>= 0.3.6)
37
- activemodel (5.2.3)
38
- activesupport (= 5.2.3)
39
- activerecord (5.2.3)
40
- activemodel (= 5.2.3)
41
- activesupport (= 5.2.3)
42
- arel (>= 9.0)
43
- activestorage (5.2.3)
44
- actionpack (= 5.2.3)
45
- activerecord (= 5.2.3)
46
- marcel (~> 0.3.1)
47
- activesupport (5.2.3)
48
- concurrent-ruby (~> 1.0, >= 1.0.2)
49
- i18n (>= 0.7, < 2)
50
- minitest (~> 5.1)
51
- tzinfo (~> 1.1)
52
- appraisal (2.2.0)
53
- bundler
54
- rake
55
- thor (>= 0.14.0)
56
- arel (9.0.0)
57
- builder (3.2.4)
58
- byebug (11.1.3)
59
- coderay (1.1.2)
60
- concurrent-ruby (1.1.6)
61
- connection_pool (2.2.2)
62
- crass (1.0.6)
63
- diff-lcs (1.3)
64
- erubi (1.9.0)
65
- globalid (0.4.2)
66
- activesupport (>= 4.2.0)
67
- i18n (0.9.5)
68
- concurrent-ruby (~> 1.0)
69
- loofah (2.5.0)
70
- crass (~> 1.0.2)
71
- nokogiri (>= 1.5.9)
72
- mail (2.7.1)
73
- mini_mime (>= 0.1.1)
74
- marcel (0.3.3)
75
- mimemagic (~> 0.3.2)
76
- method_source (1.0.0)
77
- mimemagic (0.3.5)
78
- mini_mime (1.0.2)
79
- mini_portile2 (2.1.0)
80
- minitest (5.14.1)
81
- nio4r (2.3.1)
82
- nokogiri (1.7.2)
83
- mini_portile2 (~> 2.1.0)
84
- pg (1.2.3)
85
- pry (0.13.1)
86
- coderay (~> 1.1)
87
- method_source (~> 1.0)
88
- pry-byebug (3.9.0)
89
- byebug (~> 11.0)
90
- pry (~> 0.13.0)
91
- rack (2.2.2)
92
- rack-protection (2.0.8.1)
93
- rack
94
- rack-test (1.1.0)
95
- rack (>= 1.0, < 3)
96
- rails (5.2.3)
97
- actioncable (= 5.2.3)
98
- actionmailer (= 5.2.3)
99
- actionpack (= 5.2.3)
100
- actionview (= 5.2.3)
101
- activejob (= 5.2.3)
102
- activemodel (= 5.2.3)
103
- activerecord (= 5.2.3)
104
- activestorage (= 5.2.3)
105
- activesupport (= 5.2.3)
106
- bundler (>= 1.3.0)
107
- railties (= 5.2.3)
108
- sprockets-rails (>= 2.0.0)
109
- rails-dom-testing (2.0.3)
110
- activesupport (>= 4.2.0)
111
- nokogiri (>= 1.6)
112
- rails-html-sanitizer (1.3.0)
113
- loofah (~> 2.3)
114
- railties (5.2.3)
115
- actionpack (= 5.2.3)
116
- activesupport (= 5.2.3)
117
- method_source
118
- rake (>= 0.8.7)
119
- thor (>= 0.19.0, < 2.0)
120
- rake (12.0.0)
121
- redis (3.3.3)
122
- request_store (1.5.0)
123
- rack (>= 1.4)
124
- rspec (3.9.0)
125
- rspec-core (~> 3.9.0)
126
- rspec-expectations (~> 3.9.0)
127
- rspec-mocks (~> 3.9.0)
128
- rspec-core (3.9.2)
129
- rspec-support (~> 3.9.3)
130
- rspec-expectations (3.9.2)
131
- diff-lcs (>= 1.2.0, < 2.0)
132
- rspec-support (~> 3.9.0)
133
- rspec-mocks (3.9.1)
134
- diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.9.0)
136
- rspec-rails (4.0.1)
137
- actionpack (>= 4.2)
138
- activesupport (>= 4.2)
139
- railties (>= 4.2)
140
- rspec-core (~> 3.9)
141
- rspec-expectations (~> 3.9)
142
- rspec-mocks (~> 3.9)
143
- rspec-support (~> 3.9)
144
- rspec-support (3.9.3)
145
- sidekiq (5.0.4)
146
- concurrent-ruby (~> 1.0)
147
- connection_pool (~> 2.2, >= 2.2.0)
148
- rack-protection (>= 1.5.0)
149
- redis (~> 3.3, >= 3.3.3)
150
- sprockets (3.7.2)
151
- concurrent-ruby (~> 1.0)
152
- rack (> 1, < 3)
153
- sprockets-rails (3.2.2)
154
- actionpack (>= 4.0)
155
- activesupport (>= 4.0)
156
- sprockets (>= 3.0.0)
157
- thor (1.0.1)
158
- thread_safe (0.3.6)
159
- tzinfo (1.2.7)
160
- thread_safe (~> 0.1)
161
- websocket-driver (0.7.3)
162
- websocket-extensions (>= 0.1.0)
163
- websocket-extensions (0.1.5)
164
-
165
- PLATFORMS
166
- ruby
167
-
168
- DEPENDENCIES
169
- activerecord (~> 5.2.0)
170
- activerecord-multi-tenant!
171
- appraisal
172
- byebug (~> 11.0)
173
- i18n (~> 0.9.5)
174
- nio4r (~> 2.3.1)
175
- nokogiri (~> 1.7.1)
176
- pg
177
- pry
178
- pry-byebug (= 3.9.0)
179
- rake (= 12.0.0)
180
- redis (= 3.3.3)
181
- rspec (>= 3.0)
182
- rspec-rails
183
- sidekiq
184
- sprockets (~> 3.7.1)
185
- thor
186
-
187
- BUNDLED WITH
188
- 2.1.4