activerecord-multi-tenant 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +6 -14
  4. data/Appraisals +24 -24
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile.lock +79 -63
  7. data/README.md +1 -1
  8. data/activerecord-multi-tenant.gemspec +1 -1
  9. data/gemfiles/.bundle/config +2 -0
  10. data/gemfiles/active_record_5.2.gemfile +10 -2
  11. data/gemfiles/active_record_5.2.gemfile.lock +102 -96
  12. data/gemfiles/{active_record_5.1.gemfile → active_record_6.0.gemfile} +2 -2
  13. data/gemfiles/active_record_6.0.gemfile.lock +198 -0
  14. data/gemfiles/rails_5.2.gemfile +10 -2
  15. data/gemfiles/rails_5.2.gemfile.lock +109 -103
  16. data/gemfiles/{rails_5.0.gemfile → rails_6.0.gemfile} +2 -2
  17. data/gemfiles/rails_6.0.gemfile.lock +198 -0
  18. data/lib/activerecord-multi-tenant.rb +1 -0
  19. data/lib/activerecord-multi-tenant/controller_extensions.rb +2 -6
  20. data/lib/activerecord-multi-tenant/copy_from_client.rb +2 -2
  21. data/lib/activerecord-multi-tenant/migrations.rb +2 -2
  22. data/lib/activerecord-multi-tenant/model_extensions.rb +8 -15
  23. data/lib/activerecord-multi-tenant/multi_tenant.rb +9 -0
  24. data/lib/activerecord-multi-tenant/persistence_extension.rb +13 -0
  25. data/lib/activerecord-multi-tenant/query_rewriter.rb +59 -105
  26. data/lib/activerecord-multi-tenant/sidekiq.rb +2 -1
  27. data/lib/activerecord-multi-tenant/version.rb +1 -1
  28. data/spec/activerecord-multi-tenant/controller_extensions_spec.rb +19 -24
  29. data/spec/activerecord-multi-tenant/model_extensions_spec.rb +54 -104
  30. data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +40 -0
  31. data/spec/activerecord-multi-tenant/record_modifications_spec.rb +60 -3
  32. data/spec/activerecord-multi-tenant/schema_dumper_tester.rb +0 -0
  33. data/spec/activerecord-multi-tenant/sidekiq_spec.rb +4 -4
  34. data/spec/schema.rb +1 -4
  35. data/spec/spec_helper.rb +1 -6
  36. metadata +15 -20
  37. data/gemfiles/active_record_5.1.gemfile.lock +0 -173
  38. data/gemfiles/rails_4.0.gemfile +0 -8
  39. data/gemfiles/rails_4.0.gemfile.lock +0 -141
  40. data/gemfiles/rails_4.1.gemfile +0 -8
  41. data/gemfiles/rails_4.1.gemfile.lock +0 -146
  42. data/gemfiles/rails_4.2.gemfile +0 -8
  43. data/gemfiles/rails_4.2.gemfile.lock +0 -169
  44. data/gemfiles/rails_5.0.gemfile.lock +0 -175
  45. data/gemfiles/rails_5.1.gemfile +0 -8
  46. data/gemfiles/rails_5.1.gemfile.lock +0 -175
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "activerecord", "5.1.0"
6
+ gem "activerecord", "~> 6.0.3"
7
7
 
8
- gemspec :path => "../"
8
+ gemspec path: "../"
@@ -0,0 +1,198 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ activerecord-multi-tenant (1.1.0)
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 (~> 6.0.3)
186
+ activerecord-multi-tenant!
187
+ appraisal
188
+ pg
189
+ pry
190
+ pry-byebug
191
+ rake
192
+ rspec (>= 3.0)
193
+ rspec-rails
194
+ sidekiq
195
+ thor
196
+
197
+ BUNDLED WITH
198
+ 2.1.4
@@ -3,6 +3,14 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "rails", "5.2.0"
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"
7
15
 
8
- gemspec :path => "../"
16
+ gemspec path: "../"
@@ -1,50 +1,50 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- activerecord-multi-tenant (1.0.0)
5
- rails (>= 4.0)
4
+ activerecord-multi-tenant (1.1.0)
5
+ rails (>= 4.2)
6
6
  request_store (>= 1.0.5)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.2.0)
12
- actionpack (= 5.2.0)
11
+ actioncable (5.2.3)
12
+ actionpack (= 5.2.3)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailer (5.2.0)
16
- actionpack (= 5.2.0)
17
- actionview (= 5.2.0)
18
- activejob (= 5.2.0)
15
+ actionmailer (5.2.3)
16
+ actionpack (= 5.2.3)
17
+ actionview (= 5.2.3)
18
+ activejob (= 5.2.3)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 2.0)
21
- actionpack (5.2.0)
22
- actionview (= 5.2.0)
23
- activesupport (= 5.2.0)
21
+ actionpack (5.2.3)
22
+ actionview (= 5.2.3)
23
+ activesupport (= 5.2.3)
24
24
  rack (~> 2.0)
25
25
  rack-test (>= 0.6.3)
26
26
  rails-dom-testing (~> 2.0)
27
27
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.2.0)
29
- activesupport (= 5.2.0)
28
+ actionview (5.2.3)
29
+ activesupport (= 5.2.3)
30
30
  builder (~> 3.1)
31
31
  erubi (~> 1.4)
32
32
  rails-dom-testing (~> 2.0)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.2.0)
35
- activesupport (= 5.2.0)
34
+ activejob (5.2.3)
35
+ activesupport (= 5.2.3)
36
36
  globalid (>= 0.3.6)
37
- activemodel (5.2.0)
38
- activesupport (= 5.2.0)
39
- activerecord (5.2.0)
40
- activemodel (= 5.2.0)
41
- activesupport (= 5.2.0)
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
42
  arel (>= 9.0)
43
- activestorage (5.2.0)
44
- actionpack (= 5.2.0)
45
- activerecord (= 5.2.0)
43
+ activestorage (5.2.3)
44
+ actionpack (= 5.2.3)
45
+ activerecord (= 5.2.3)
46
46
  marcel (~> 0.3.1)
47
- activesupport (5.2.0)
47
+ activesupport (5.2.3)
48
48
  concurrent-ruby (~> 1.0, >= 1.0.2)
49
49
  i18n (>= 0.7, < 2)
50
50
  minitest (~> 5.1)
@@ -54,113 +54,113 @@ GEM
54
54
  rake
55
55
  thor (>= 0.14.0)
56
56
  arel (9.0.0)
57
- builder (3.2.3)
58
- byebug (10.0.2)
57
+ builder (3.2.4)
58
+ byebug (11.1.3)
59
59
  coderay (1.1.2)
60
- concurrent-ruby (1.0.5)
61
- connection_pool (2.2.1)
62
- crass (1.0.4)
60
+ concurrent-ruby (1.1.6)
61
+ connection_pool (2.2.2)
62
+ crass (1.0.6)
63
63
  diff-lcs (1.3)
64
- erubi (1.7.1)
65
- globalid (0.4.1)
64
+ erubi (1.9.0)
65
+ globalid (0.4.2)
66
66
  activesupport (>= 4.2.0)
67
- i18n (1.0.0)
67
+ i18n (0.9.5)
68
68
  concurrent-ruby (~> 1.0)
69
- loofah (2.2.2)
69
+ loofah (2.5.0)
70
70
  crass (~> 1.0.2)
71
71
  nokogiri (>= 1.5.9)
72
- mail (2.7.0)
72
+ mail (2.7.1)
73
73
  mini_mime (>= 0.1.1)
74
- marcel (0.3.2)
74
+ marcel (0.3.3)
75
75
  mimemagic (~> 0.3.2)
76
- method_source (0.9.0)
77
- mimemagic (0.3.2)
78
- mini_mime (1.0.0)
79
- mini_portile2 (2.3.0)
80
- minitest (5.11.3)
81
- nio4r (2.3.0)
82
- nokogiri (1.8.2)
83
- mini_portile2 (~> 2.3.0)
84
- pg (1.0.0)
85
- pry (0.11.3)
86
- coderay (~> 1.1.0)
87
- method_source (~> 0.9.0)
88
- pry-byebug (3.6.0)
89
- byebug (~> 10.0)
90
- pry (~> 0.10)
91
- rack (2.0.5)
92
- rack-protection (2.0.1)
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
93
  rack
94
- rack-test (1.0.0)
94
+ rack-test (1.1.0)
95
95
  rack (>= 1.0, < 3)
96
- rails (5.2.0)
97
- actioncable (= 5.2.0)
98
- actionmailer (= 5.2.0)
99
- actionpack (= 5.2.0)
100
- actionview (= 5.2.0)
101
- activejob (= 5.2.0)
102
- activemodel (= 5.2.0)
103
- activerecord (= 5.2.0)
104
- activestorage (= 5.2.0)
105
- activesupport (= 5.2.0)
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
106
  bundler (>= 1.3.0)
107
- railties (= 5.2.0)
107
+ railties (= 5.2.3)
108
108
  sprockets-rails (>= 2.0.0)
109
109
  rails-dom-testing (2.0.3)
110
110
  activesupport (>= 4.2.0)
111
111
  nokogiri (>= 1.6)
112
- rails-html-sanitizer (1.0.4)
113
- loofah (~> 2.2, >= 2.2.2)
114
- railties (5.2.0)
115
- actionpack (= 5.2.0)
116
- activesupport (= 5.2.0)
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
117
  method_source
118
118
  rake (>= 0.8.7)
119
- thor (>= 0.18.1, < 2.0)
120
- rake (12.3.1)
121
- redis (4.0.1)
122
- request_store (1.4.1)
119
+ thor (>= 0.19.0, < 2.0)
120
+ rake (12.0.0)
121
+ redis (3.3.3)
122
+ request_store (1.5.0)
123
123
  rack (>= 1.4)
124
- rspec (3.7.0)
125
- rspec-core (~> 3.7.0)
126
- rspec-expectations (~> 3.7.0)
127
- rspec-mocks (~> 3.7.0)
128
- rspec-core (3.7.1)
129
- rspec-support (~> 3.7.0)
130
- rspec-expectations (3.7.0)
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
131
  diff-lcs (>= 1.2.0, < 2.0)
132
- rspec-support (~> 3.7.0)
133
- rspec-mocks (3.7.0)
132
+ rspec-support (~> 3.9.0)
133
+ rspec-mocks (3.9.1)
134
134
  diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.7.0)
136
- rspec-rails (3.7.2)
137
- actionpack (>= 3.0)
138
- activesupport (>= 3.0)
139
- railties (>= 3.0)
140
- rspec-core (~> 3.7.0)
141
- rspec-expectations (~> 3.7.0)
142
- rspec-mocks (~> 3.7.0)
143
- rspec-support (~> 3.7.0)
144
- rspec-support (3.7.1)
145
- sidekiq (5.1.3)
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
146
  concurrent-ruby (~> 1.0)
147
147
  connection_pool (~> 2.2, >= 2.2.0)
148
148
  rack-protection (>= 1.5.0)
149
- redis (>= 3.3.5, < 5)
150
- sprockets (3.7.1)
149
+ redis (~> 3.3, >= 3.3.3)
150
+ sprockets (3.7.2)
151
151
  concurrent-ruby (~> 1.0)
152
152
  rack (> 1, < 3)
153
153
  sprockets-rails (3.2.1)
154
154
  actionpack (>= 4.0)
155
155
  activesupport (>= 4.0)
156
156
  sprockets (>= 3.0.0)
157
- thor (0.20.0)
157
+ thor (1.0.1)
158
158
  thread_safe (0.3.6)
159
- tzinfo (1.2.5)
159
+ tzinfo (1.2.7)
160
160
  thread_safe (~> 0.1)
161
- websocket-driver (0.7.0)
161
+ websocket-driver (0.7.2)
162
162
  websocket-extensions (>= 0.1.0)
163
- websocket-extensions (0.1.3)
163
+ websocket-extensions (0.1.4)
164
164
 
165
165
  PLATFORMS
166
166
  ruby
@@ -168,15 +168,21 @@ PLATFORMS
168
168
  DEPENDENCIES
169
169
  activerecord-multi-tenant!
170
170
  appraisal
171
+ byebug (~> 11.0)
172
+ i18n (~> 0.9.5)
173
+ nio4r (~> 2.3.1)
174
+ nokogiri (~> 1.7.1)
171
175
  pg
172
176
  pry
173
- pry-byebug
174
- rails (= 5.2.0)
175
- rake
177
+ pry-byebug (= 3.9.0)
178
+ rails (~> 5.2.0)
179
+ rake (= 12.0.0)
180
+ redis (= 3.3.3)
176
181
  rspec (>= 3.0)
177
182
  rspec-rails
178
183
  sidekiq
184
+ sprockets (~> 3.7.1)
179
185
  thor
180
186
 
181
187
  BUNDLED WITH
182
- 1.17.2
188
+ 2.1.4