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
@@ -1,198 +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.1)
12
- actionpack (= 6.0.3.1)
13
- nio4r (~> 2.0)
14
- websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.3.1)
16
- actionpack (= 6.0.3.1)
17
- activejob (= 6.0.3.1)
18
- activerecord (= 6.0.3.1)
19
- activestorage (= 6.0.3.1)
20
- activesupport (= 6.0.3.1)
21
- mail (>= 2.7.1)
22
- actionmailer (6.0.3.1)
23
- actionpack (= 6.0.3.1)
24
- actionview (= 6.0.3.1)
25
- activejob (= 6.0.3.1)
26
- mail (~> 2.5, >= 2.5.4)
27
- rails-dom-testing (~> 2.0)
28
- actionpack (6.0.3.1)
29
- actionview (= 6.0.3.1)
30
- activesupport (= 6.0.3.1)
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.1)
36
- actionpack (= 6.0.3.1)
37
- activerecord (= 6.0.3.1)
38
- activestorage (= 6.0.3.1)
39
- activesupport (= 6.0.3.1)
40
- nokogiri (>= 1.8.5)
41
- actionview (6.0.3.1)
42
- activesupport (= 6.0.3.1)
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.1)
48
- activesupport (= 6.0.3.1)
49
- globalid (>= 0.3.6)
50
- activemodel (6.0.3.1)
51
- activesupport (= 6.0.3.1)
52
- activerecord (6.0.3.1)
53
- activemodel (= 6.0.3.1)
54
- activesupport (= 6.0.3.1)
55
- activestorage (6.0.3.1)
56
- actionpack (= 6.0.3.1)
57
- activejob (= 6.0.3.1)
58
- activerecord (= 6.0.3.1)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.1)
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.1.3)
72
- coderay (1.1.2)
73
- concurrent-ruby (1.1.6)
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.2)
81
- concurrent-ruby (~> 1.0)
82
- loofah (2.5.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 (1.0.0)
90
- mimemagic (0.3.5)
91
- mini_mime (1.0.2)
92
- mini_portile2 (2.4.0)
93
- minitest (5.14.1)
94
- nio4r (2.5.2)
95
- nokogiri (1.10.9)
96
- mini_portile2 (~> 2.4.0)
97
- pg (1.2.3)
98
- pry (0.13.1)
99
- coderay (~> 1.1)
100
- method_source (~> 1.0)
101
- pry-byebug (3.9.0)
102
- byebug (~> 11.0)
103
- pry (~> 0.13.0)
104
- rack (2.2.2)
105
- rack-protection (2.0.8.1)
106
- rack
107
- rack-test (1.1.0)
108
- rack (>= 1.0, < 3)
109
- rails (6.0.3.1)
110
- actioncable (= 6.0.3.1)
111
- actionmailbox (= 6.0.3.1)
112
- actionmailer (= 6.0.3.1)
113
- actionpack (= 6.0.3.1)
114
- actiontext (= 6.0.3.1)
115
- actionview (= 6.0.3.1)
116
- activejob (= 6.0.3.1)
117
- activemodel (= 6.0.3.1)
118
- activerecord (= 6.0.3.1)
119
- activestorage (= 6.0.3.1)
120
- activesupport (= 6.0.3.1)
121
- bundler (>= 1.3.0)
122
- railties (= 6.0.3.1)
123
- sprockets-rails (>= 2.0.0)
124
- rails-dom-testing (2.0.3)
125
- activesupport (>= 4.2.0)
126
- nokogiri (>= 1.6)
127
- rails-html-sanitizer (1.3.0)
128
- loofah (~> 2.3)
129
- railties (6.0.3.1)
130
- actionpack (= 6.0.3.1)
131
- activesupport (= 6.0.3.1)
132
- method_source
133
- rake (>= 0.8.7)
134
- thor (>= 0.20.3, < 2.0)
135
- rake (13.0.1)
136
- redis (4.1.4)
137
- request_store (1.5.0)
138
- rack (>= 1.4)
139
- rspec (3.9.0)
140
- rspec-core (~> 3.9.0)
141
- rspec-expectations (~> 3.9.0)
142
- rspec-mocks (~> 3.9.0)
143
- rspec-core (3.9.2)
144
- rspec-support (~> 3.9.3)
145
- rspec-expectations (3.9.2)
146
- diff-lcs (>= 1.2.0, < 2.0)
147
- rspec-support (~> 3.9.0)
148
- rspec-mocks (3.9.1)
149
- diff-lcs (>= 1.2.0, < 2.0)
150
- rspec-support (~> 3.9.0)
151
- rspec-rails (4.0.1)
152
- actionpack (>= 4.2)
153
- activesupport (>= 4.2)
154
- railties (>= 4.2)
155
- rspec-core (~> 3.9)
156
- rspec-expectations (~> 3.9)
157
- rspec-mocks (~> 3.9)
158
- rspec-support (~> 3.9)
159
- rspec-support (3.9.3)
160
- sidekiq (6.0.7)
161
- connection_pool (>= 2.2.2)
162
- rack (~> 2.0)
163
- rack-protection (>= 2.0.0)
164
- redis (>= 4.1.0)
165
- sprockets (4.0.0)
166
- concurrent-ruby (~> 1.0)
167
- rack (> 1, < 3)
168
- sprockets-rails (3.2.1)
169
- actionpack (>= 4.0)
170
- activesupport (>= 4.0)
171
- sprockets (>= 3.0.0)
172
- thor (1.0.1)
173
- thread_safe (0.3.6)
174
- tzinfo (1.2.7)
175
- thread_safe (~> 0.1)
176
- websocket-driver (0.7.2)
177
- websocket-extensions (>= 0.1.0)
178
- websocket-extensions (0.1.4)
179
- zeitwerk (2.3.0)
180
-
181
- PLATFORMS
182
- ruby
183
-
184
- DEPENDENCIES
185
- activerecord-multi-tenant!
186
- appraisal
187
- pg
188
- pry
189
- pry-byebug
190
- rails (~> 6.0.3)
191
- rake
192
- rspec (>= 3.0)
193
- rspec-rails
194
- sidekiq
195
- thor
196
-
197
- BUNDLED WITH
198
- 2.1.4
@@ -1,198 +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.1.0)
12
- actionpack (= 6.1.0)
13
- activesupport (= 6.1.0)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.0)
17
- actionpack (= 6.1.0)
18
- activejob (= 6.1.0)
19
- activerecord (= 6.1.0)
20
- activestorage (= 6.1.0)
21
- activesupport (= 6.1.0)
22
- mail (>= 2.7.1)
23
- actionmailer (6.1.0)
24
- actionpack (= 6.1.0)
25
- actionview (= 6.1.0)
26
- activejob (= 6.1.0)
27
- activesupport (= 6.1.0)
28
- mail (~> 2.5, >= 2.5.4)
29
- rails-dom-testing (~> 2.0)
30
- actionpack (6.1.0)
31
- actionview (= 6.1.0)
32
- activesupport (= 6.1.0)
33
- rack (~> 2.0, >= 2.0.9)
34
- rack-test (>= 0.6.3)
35
- rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.0)
38
- actionpack (= 6.1.0)
39
- activerecord (= 6.1.0)
40
- activestorage (= 6.1.0)
41
- activesupport (= 6.1.0)
42
- nokogiri (>= 1.8.5)
43
- actionview (6.1.0)
44
- activesupport (= 6.1.0)
45
- builder (~> 3.1)
46
- erubi (~> 1.4)
47
- rails-dom-testing (~> 2.0)
48
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.0)
50
- activesupport (= 6.1.0)
51
- globalid (>= 0.3.6)
52
- activemodel (6.1.0)
53
- activesupport (= 6.1.0)
54
- activerecord (6.1.0)
55
- activemodel (= 6.1.0)
56
- activesupport (= 6.1.0)
57
- activestorage (6.1.0)
58
- actionpack (= 6.1.0)
59
- activejob (= 6.1.0)
60
- activerecord (= 6.1.0)
61
- activesupport (= 6.1.0)
62
- marcel (~> 0.3.1)
63
- mimemagic (~> 0.3.2)
64
- activesupport (6.1.0)
65
- concurrent-ruby (~> 1.0, >= 1.0.2)
66
- i18n (>= 1.6, < 2)
67
- minitest (>= 5.1)
68
- tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
- appraisal (2.3.0)
71
- bundler
72
- rake
73
- thor (>= 0.14.0)
74
- builder (3.2.4)
75
- byebug (11.1.3)
76
- coderay (1.1.3)
77
- concurrent-ruby (1.1.7)
78
- connection_pool (2.2.3)
79
- crass (1.0.6)
80
- diff-lcs (1.4.4)
81
- erubi (1.10.0)
82
- globalid (0.4.2)
83
- activesupport (>= 4.2.0)
84
- i18n (1.8.5)
85
- concurrent-ruby (~> 1.0)
86
- loofah (2.8.0)
87
- crass (~> 1.0.2)
88
- nokogiri (>= 1.5.9)
89
- mail (2.7.1)
90
- mini_mime (>= 0.1.1)
91
- marcel (0.3.3)
92
- mimemagic (~> 0.3.2)
93
- method_source (1.0.0)
94
- mimemagic (0.3.5)
95
- mini_mime (1.0.2)
96
- mini_portile2 (2.4.0)
97
- minitest (5.14.2)
98
- nio4r (2.5.4)
99
- nokogiri (1.10.10)
100
- mini_portile2 (~> 2.4.0)
101
- pg (1.2.3)
102
- pry (0.13.1)
103
- coderay (~> 1.1)
104
- method_source (~> 1.0)
105
- pry-byebug (3.9.0)
106
- byebug (~> 11.0)
107
- pry (~> 0.13.0)
108
- rack (2.2.3)
109
- rack-test (1.1.0)
110
- rack (>= 1.0, < 3)
111
- rails (6.1.0)
112
- actioncable (= 6.1.0)
113
- actionmailbox (= 6.1.0)
114
- actionmailer (= 6.1.0)
115
- actionpack (= 6.1.0)
116
- actiontext (= 6.1.0)
117
- actionview (= 6.1.0)
118
- activejob (= 6.1.0)
119
- activemodel (= 6.1.0)
120
- activerecord (= 6.1.0)
121
- activestorage (= 6.1.0)
122
- activesupport (= 6.1.0)
123
- bundler (>= 1.15.0)
124
- railties (= 6.1.0)
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.1.0)
132
- actionpack (= 6.1.0)
133
- activesupport (= 6.1.0)
134
- method_source
135
- rake (>= 0.8.7)
136
- thor (~> 1.0)
137
- rake (13.0.3)
138
- redis (4.2.5)
139
- request_store (1.5.0)
140
- rack (>= 1.4)
141
- rspec (3.10.0)
142
- rspec-core (~> 3.10.0)
143
- rspec-expectations (~> 3.10.0)
144
- rspec-mocks (~> 3.10.0)
145
- rspec-core (3.10.1)
146
- rspec-support (~> 3.10.0)
147
- rspec-expectations (3.10.1)
148
- diff-lcs (>= 1.2.0, < 2.0)
149
- rspec-support (~> 3.10.0)
150
- rspec-mocks (3.10.1)
151
- diff-lcs (>= 1.2.0, < 2.0)
152
- rspec-support (~> 3.10.0)
153
- rspec-rails (4.0.2)
154
- actionpack (>= 4.2)
155
- activesupport (>= 4.2)
156
- railties (>= 4.2)
157
- rspec-core (~> 3.10)
158
- rspec-expectations (~> 3.10)
159
- rspec-mocks (~> 3.10)
160
- rspec-support (~> 3.10)
161
- rspec-support (3.10.1)
162
- sidekiq (6.1.2)
163
- connection_pool (>= 2.2.2)
164
- rack (~> 2.0)
165
- redis (>= 4.2.0)
166
- sprockets (4.0.2)
167
- concurrent-ruby (~> 1.0)
168
- rack (> 1, < 3)
169
- sprockets-rails (3.2.2)
170
- actionpack (>= 4.0)
171
- activesupport (>= 4.0)
172
- sprockets (>= 3.0.0)
173
- thor (1.0.1)
174
- tzinfo (2.0.4)
175
- concurrent-ruby (~> 1.0)
176
- websocket-driver (0.7.3)
177
- websocket-extensions (>= 0.1.0)
178
- websocket-extensions (0.1.5)
179
- zeitwerk (2.4.2)
180
-
181
- PLATFORMS
182
- ruby
183
-
184
- DEPENDENCIES
185
- activerecord-multi-tenant!
186
- appraisal
187
- pg
188
- pry
189
- pry-byebug
190
- rails (~> 6.1.0)
191
- rake
192
- rspec (>= 3.0)
193
- rspec-rails
194
- sidekiq
195
- thor
196
-
197
- BUNDLED WITH
198
- 2.1.4
@@ -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