activerecord-multi-tenant 1.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +51 -0
- data/Gemfile +3 -1
- data/LICENSE +0 -0
- data/README.md +3 -2
- data/Rakefile +1 -1
- data/activerecord-multi-tenant.gemspec +28 -23
- 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 +98 -34
- data/lib/activerecord-multi-tenant/multi_tenant.rb +102 -29
- data/lib/activerecord-multi-tenant/query_monitor.rb +21 -5
- data/lib/activerecord-multi-tenant/query_rewriter.rb +122 -91
- 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 +347 -143
- 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 +43 -2
- data/spec/spec_helper.rb +52 -16
- data/spec/support/format_sql.rb +20 -0
- metadata +126 -36
- data/.github/workflows/CI.yml +0 -63
- data/gemfiles/.bundle/config +0 -2
- 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.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
@@ -0,0 +1,554 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: MultiTenant::MigrationExtensions
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "MultiTenant::MigrationExtensions";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MigrationExtensions</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: MultiTenant::MigrationExtensions
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/activerecord-multi-tenant/migrations.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<h2>
|
95
|
+
Instance Method Summary
|
96
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
97
|
+
</h2>
|
98
|
+
|
99
|
+
<ul class="summary">
|
100
|
+
|
101
|
+
<li class="public ">
|
102
|
+
<span class="summary_signature">
|
103
|
+
|
104
|
+
<a href="#citus_version-instance_method" title="#citus_version (instance method)">#<strong>citus_version</strong> ⇒ Object </a>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</span>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
119
|
+
|
120
|
+
</li>
|
121
|
+
|
122
|
+
|
123
|
+
<li class="public ">
|
124
|
+
<span class="summary_signature">
|
125
|
+
|
126
|
+
<a href="#create_distributed_table-instance_method" title="#create_distributed_table (instance method)">#<strong>create_distributed_table</strong>(table_name, partition_key) ⇒ Object </a>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
</span>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#create_reference_table-instance_method" title="#create_reference_table (instance method)">#<strong>create_reference_table</strong>(table_name) ⇒ Object </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
163
|
+
|
164
|
+
</li>
|
165
|
+
|
166
|
+
|
167
|
+
<li class="public ">
|
168
|
+
<span class="summary_signature">
|
169
|
+
|
170
|
+
<a href="#enable_extension_on_all_nodes-instance_method" title="#enable_extension_on_all_nodes (instance method)">#<strong>enable_extension_on_all_nodes</strong>(extension) ⇒ Object </a>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
</span>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
185
|
+
|
186
|
+
</li>
|
187
|
+
|
188
|
+
|
189
|
+
<li class="public ">
|
190
|
+
<span class="summary_signature">
|
191
|
+
|
192
|
+
<a href="#execute_on_all_nodes-instance_method" title="#execute_on_all_nodes (instance method)">#<strong>execute_on_all_nodes</strong>(sql) ⇒ Object </a>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
207
|
+
|
208
|
+
</li>
|
209
|
+
|
210
|
+
|
211
|
+
<li class="public ">
|
212
|
+
<span class="summary_signature">
|
213
|
+
|
214
|
+
<a href="#rebalance_table_shards-instance_method" title="#rebalance_table_shards (instance method)">#<strong>rebalance_table_shards</strong> ⇒ Object </a>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
</span>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
229
|
+
|
230
|
+
</li>
|
231
|
+
|
232
|
+
|
233
|
+
<li class="public ">
|
234
|
+
<span class="summary_signature">
|
235
|
+
|
236
|
+
<a href="#undistribute_table-instance_method" title="#undistribute_table (instance method)">#<strong>undistribute_table</strong>(table_name) ⇒ Object </a>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</span>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
251
|
+
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
</ul>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
<div id="instance_method_details" class="method_details_list">
|
261
|
+
<h2>Instance Method Details</h2>
|
262
|
+
|
263
|
+
|
264
|
+
<div class="method_details first">
|
265
|
+
<h3 class="signature first" id="citus_version-instance_method">
|
266
|
+
|
267
|
+
#<strong>citus_version</strong> ⇒ <tt>Object</tt>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
</h3><table class="source_code">
|
274
|
+
<tr>
|
275
|
+
<td>
|
276
|
+
<pre class="lines">
|
277
|
+
|
278
|
+
|
279
|
+
59
|
280
|
+
60
|
281
|
+
61
|
282
|
+
62
|
283
|
+
63</pre>
|
284
|
+
</td>
|
285
|
+
<td>
|
286
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 59</span>
|
287
|
+
|
288
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_citus_version'>citus_version</span>
|
289
|
+
<span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT extversion FROM pg_extension WHERE extname = 'citus'</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_getvalue'>getvalue</span><span class='lparen'>(</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:split</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_try'>try</span><span class='lparen'>(</span><span class='symbol'>:first</span><span class='rparen'>)</span>
|
290
|
+
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
291
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='kw'>unless</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>invalid tuple number 0</span><span class='tstring_end'>'</span></span>
|
292
|
+
<span class='kw'>end</span></pre>
|
293
|
+
</td>
|
294
|
+
</tr>
|
295
|
+
</table>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<div class="method_details ">
|
299
|
+
<h3 class="signature " id="create_distributed_table-instance_method">
|
300
|
+
|
301
|
+
#<strong>create_distributed_table</strong>(table_name, partition_key) ⇒ <tt>Object</tt>
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</h3><table class="source_code">
|
308
|
+
<tr>
|
309
|
+
<td>
|
310
|
+
<pre class="lines">
|
311
|
+
|
312
|
+
|
313
|
+
3
|
314
|
+
4
|
315
|
+
5
|
316
|
+
6
|
317
|
+
7
|
318
|
+
8
|
319
|
+
9
|
320
|
+
10
|
321
|
+
11
|
322
|
+
12
|
323
|
+
13
|
324
|
+
14</pre>
|
325
|
+
</td>
|
326
|
+
<td>
|
327
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 3</span>
|
328
|
+
|
329
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_distributed_table'>create_distributed_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_partition_key'>partition_key</span><span class='rparen'>)</span>
|
330
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_citus_version'>citus_version</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
331
|
+
|
332
|
+
<span class='id identifier rubyid_reversible'>reversible</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_dir'>dir</span><span class='op'>|</span>
|
333
|
+
<span class='id identifier rubyid_dir'>dir</span><span class='period'>.</span><span class='id identifier rubyid_up'>up</span> <span class='kw'>do</span>
|
334
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT create_distributed_table($$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_table_name'>table_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$, $$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_partition_key'>partition_key</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$)</span><span class='tstring_end'>"</span></span>
|
335
|
+
<span class='kw'>end</span>
|
336
|
+
<span class='id identifier rubyid_dir'>dir</span><span class='period'>.</span><span class='id identifier rubyid_down'>down</span> <span class='kw'>do</span>
|
337
|
+
<span class='id identifier rubyid_undistribute_table'>undistribute_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
338
|
+
<span class='kw'>end</span>
|
339
|
+
<span class='kw'>end</span>
|
340
|
+
<span class='kw'>end</span></pre>
|
341
|
+
</td>
|
342
|
+
</tr>
|
343
|
+
</table>
|
344
|
+
</div>
|
345
|
+
|
346
|
+
<div class="method_details ">
|
347
|
+
<h3 class="signature " id="create_reference_table-instance_method">
|
348
|
+
|
349
|
+
#<strong>create_reference_table</strong>(table_name) ⇒ <tt>Object</tt>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
</h3><table class="source_code">
|
356
|
+
<tr>
|
357
|
+
<td>
|
358
|
+
<pre class="lines">
|
359
|
+
|
360
|
+
|
361
|
+
16
|
362
|
+
17
|
363
|
+
18
|
364
|
+
19
|
365
|
+
20
|
366
|
+
21
|
367
|
+
22
|
368
|
+
23
|
369
|
+
24
|
370
|
+
25
|
371
|
+
26
|
372
|
+
27</pre>
|
373
|
+
</td>
|
374
|
+
<td>
|
375
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 16</span>
|
376
|
+
|
377
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_reference_table'>create_reference_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
378
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_citus_version'>citus_version</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
379
|
+
|
380
|
+
<span class='id identifier rubyid_reversible'>reversible</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_dir'>dir</span><span class='op'>|</span>
|
381
|
+
<span class='id identifier rubyid_dir'>dir</span><span class='period'>.</span><span class='id identifier rubyid_up'>up</span> <span class='kw'>do</span>
|
382
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT create_reference_table($$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_table_name'>table_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$)</span><span class='tstring_end'>"</span></span>
|
383
|
+
<span class='kw'>end</span>
|
384
|
+
<span class='id identifier rubyid_dir'>dir</span><span class='period'>.</span><span class='id identifier rubyid_down'>down</span> <span class='kw'>do</span>
|
385
|
+
<span class='id identifier rubyid_undistribute_table'>undistribute_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
386
|
+
<span class='kw'>end</span>
|
387
|
+
<span class='kw'>end</span>
|
388
|
+
<span class='kw'>end</span></pre>
|
389
|
+
</td>
|
390
|
+
</tr>
|
391
|
+
</table>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div class="method_details ">
|
395
|
+
<h3 class="signature " id="enable_extension_on_all_nodes-instance_method">
|
396
|
+
|
397
|
+
#<strong>enable_extension_on_all_nodes</strong>(extension) ⇒ <tt>Object</tt>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
</h3><table class="source_code">
|
404
|
+
<tr>
|
405
|
+
<td>
|
406
|
+
<pre class="lines">
|
407
|
+
|
408
|
+
|
409
|
+
55
|
410
|
+
56
|
411
|
+
57</pre>
|
412
|
+
</td>
|
413
|
+
<td>
|
414
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 55</span>
|
415
|
+
|
416
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_enable_extension_on_all_nodes'>enable_extension_on_all_nodes</span><span class='lparen'>(</span><span class='id identifier rubyid_extension'>extension</span><span class='rparen'>)</span>
|
417
|
+
<span class='id identifier rubyid_execute_on_all_nodes'>execute_on_all_nodes</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>CREATE EXTENSION IF NOT EXISTS \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_extension'>extension</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span>
|
418
|
+
<span class='kw'>end</span></pre>
|
419
|
+
</td>
|
420
|
+
</tr>
|
421
|
+
</table>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<div class="method_details ">
|
425
|
+
<h3 class="signature " id="execute_on_all_nodes-instance_method">
|
426
|
+
|
427
|
+
#<strong>execute_on_all_nodes</strong>(sql) ⇒ <tt>Object</tt>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
</h3><table class="source_code">
|
434
|
+
<tr>
|
435
|
+
<td>
|
436
|
+
<pre class="lines">
|
437
|
+
|
438
|
+
|
439
|
+
41
|
440
|
+
42
|
441
|
+
43
|
442
|
+
44
|
443
|
+
45
|
444
|
+
46
|
445
|
+
47
|
446
|
+
48
|
447
|
+
49
|
448
|
+
50
|
449
|
+
51
|
450
|
+
52
|
451
|
+
53</pre>
|
452
|
+
</td>
|
453
|
+
<td>
|
454
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 41</span>
|
455
|
+
|
456
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute_on_all_nodes'>execute_on_all_nodes</span><span class='lparen'>(</span><span class='id identifier rubyid_sql'>sql</span><span class='rparen'>)</span>
|
457
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='id identifier rubyid_sql'>sql</span>
|
458
|
+
|
459
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_citus_version'>citus_version</span>
|
460
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>6.0</span><span class='tstring_end'>'</span></span>
|
461
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT citus_run_on_all_workers($$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sql'>sql</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$)</span><span class='tstring_end'>"</span></span> <span class='comment'># initial citus_tools.sql with different names
|
462
|
+
</span> <span class='kw'>when</span> <span class='kw'>nil</span>
|
463
|
+
<span class='comment'># Do nothing, this is regular Postgres
|
464
|
+
</span> <span class='kw'>else</span>
|
465
|
+
<span class='comment'># 6.1 and newer
|
466
|
+
</span> <span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT run_command_on_workers($$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sql'>sql</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$)</span><span class='tstring_end'>"</span></span>
|
467
|
+
<span class='kw'>end</span>
|
468
|
+
<span class='kw'>end</span></pre>
|
469
|
+
</td>
|
470
|
+
</tr>
|
471
|
+
</table>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
<div class="method_details ">
|
475
|
+
<h3 class="signature " id="rebalance_table_shards-instance_method">
|
476
|
+
|
477
|
+
#<strong>rebalance_table_shards</strong> ⇒ <tt>Object</tt>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
</h3><table class="source_code">
|
484
|
+
<tr>
|
485
|
+
<td>
|
486
|
+
<pre class="lines">
|
487
|
+
|
488
|
+
|
489
|
+
35
|
490
|
+
36
|
491
|
+
37
|
492
|
+
38
|
493
|
+
39</pre>
|
494
|
+
</td>
|
495
|
+
<td>
|
496
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 35</span>
|
497
|
+
|
498
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_rebalance_table_shards'>rebalance_table_shards</span>
|
499
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_citus_version'>citus_version</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
500
|
+
|
501
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SELECT rebalance_table_shards()</span><span class='tstring_end'>'</span></span>
|
502
|
+
<span class='kw'>end</span></pre>
|
503
|
+
</td>
|
504
|
+
</tr>
|
505
|
+
</table>
|
506
|
+
</div>
|
507
|
+
|
508
|
+
<div class="method_details ">
|
509
|
+
<h3 class="signature " id="undistribute_table-instance_method">
|
510
|
+
|
511
|
+
#<strong>undistribute_table</strong>(table_name) ⇒ <tt>Object</tt>
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
</h3><table class="source_code">
|
518
|
+
<tr>
|
519
|
+
<td>
|
520
|
+
<pre class="lines">
|
521
|
+
|
522
|
+
|
523
|
+
29
|
524
|
+
30
|
525
|
+
31
|
526
|
+
32
|
527
|
+
33</pre>
|
528
|
+
</td>
|
529
|
+
<td>
|
530
|
+
<pre class="code"><span class="info file"># File 'lib/activerecord-multi-tenant/migrations.rb', line 29</span>
|
531
|
+
|
532
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_undistribute_table'>undistribute_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
533
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_citus_version'>citus_version</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
|
534
|
+
|
535
|
+
<span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT undistribute_table($$</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_table_name'>table_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>$$))</span><span class='tstring_end'>"</span></span>
|
536
|
+
<span class='kw'>end</span></pre>
|
537
|
+
</td>
|
538
|
+
</tr>
|
539
|
+
</table>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
</div>
|
543
|
+
|
544
|
+
</div>
|
545
|
+
|
546
|
+
<div id="footer">
|
547
|
+
Generated on Sat May 27 10:16:24 2023 by
|
548
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
549
|
+
0.9.34 (ruby-3.2.2).
|
550
|
+
</div>
|
551
|
+
|
552
|
+
</div>
|
553
|
+
</body>
|
554
|
+
</html>
|
@@ -0,0 +1,124 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Exception: MultiTenant::MissingTenantError
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "MultiTenant::MissingTenantError";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../MultiTenant.html" title="MultiTenant (module)">MultiTenant</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MissingTenantError</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Exception: MultiTenant::MissingTenantError
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">StandardError</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">StandardError</li>
|
78
|
+
|
79
|
+
<li class="next">MultiTenant::MissingTenantError</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/activerecord-multi-tenant/multi_tenant.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="footer">
|
117
|
+
Generated on Sat May 27 10:16:24 2023 by
|
118
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
|
+
0.9.34 (ruby-3.2.2).
|
120
|
+
</div>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
</body>
|
124
|
+
</html>
|