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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f277cdbd6175c03dcbbca13e06220f5612fdf40cefb539a3619b4afa0077d369
|
4
|
+
data.tar.gz: bae03db825cc60a9833a2287245b7ff5f62ede9aa67497594e867832a75eaedf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fad6c663f7f588e1359ea4f831b1c66d24de31fa9895aee3ac42d59851597b3ceabf2576c4e2eb49f55baef6eaeb787fee946085b43909450580d4b6a66817cb
|
7
|
+
data.tar.gz: c58700fda6a8e99b928435f2bd5abfdc62eb6ccb249ab21350d12f25d9b6ff29860d12451e5e8a77aa2666302d8a9dbfa9bc062dab450ecfdfce2226452c0d43
|
@@ -0,0 +1,83 @@
|
|
1
|
+
name: Active Record Multi-Tenant Tests
|
2
|
+
|
3
|
+
env:
|
4
|
+
CI: true
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- "**"
|
9
|
+
pull_request:
|
10
|
+
types: [ opened, reopened, synchronize ]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
|
14
|
+
static-checks:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
steps:
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 3.2
|
20
|
+
bundler-cache: true
|
21
|
+
- uses: actions/checkout@v3
|
22
|
+
- name: Rubocop static code analysis
|
23
|
+
run: |
|
24
|
+
gem install rubocop
|
25
|
+
rubocop
|
26
|
+
doc_checks:
|
27
|
+
runs-on: ubuntu-latest
|
28
|
+
steps:
|
29
|
+
- uses: actions/setup-python@v4
|
30
|
+
with:
|
31
|
+
python-version: 3.9
|
32
|
+
- uses: actions/checkout@v3
|
33
|
+
- name: Install python dependencies
|
34
|
+
run: |
|
35
|
+
pip install -r docs/requirements.txt
|
36
|
+
- name: Documentation Checks
|
37
|
+
run: |
|
38
|
+
cd docs
|
39
|
+
sphinx-build -W -b html source builds
|
40
|
+
|
41
|
+
build:
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
strategy:
|
44
|
+
fail-fast: false
|
45
|
+
matrix:
|
46
|
+
ruby:
|
47
|
+
- '3.0'
|
48
|
+
- '3.1'
|
49
|
+
- '3.2'
|
50
|
+
appraisal:
|
51
|
+
- rails-6.0
|
52
|
+
- rails-6.1
|
53
|
+
- rails-7.0
|
54
|
+
- rails-7.1
|
55
|
+
- active-record-6.0
|
56
|
+
- active-record-6.1
|
57
|
+
- active-record-7.0
|
58
|
+
- active-record-7.1
|
59
|
+
citus_version:
|
60
|
+
- '10'
|
61
|
+
- '11'
|
62
|
+
- '12'
|
63
|
+
|
64
|
+
name: Ruby ${{ matrix.ruby }}/${{ matrix.gemfile }} / Citus ${{ matrix.citus_version }}
|
65
|
+
env:
|
66
|
+
APPRAISAL: ${{ matrix.appraisal }}
|
67
|
+
CITUS_VERSION: ${{ matrix.citus_version }}
|
68
|
+
steps:
|
69
|
+
- uses: actions/checkout@v3
|
70
|
+
|
71
|
+
- name: Start Citus Database environment
|
72
|
+
run: docker-compose up -d
|
73
|
+
|
74
|
+
- uses: ruby/setup-ruby@v1
|
75
|
+
with:
|
76
|
+
ruby-version: ${{ matrix.ruby }}
|
77
|
+
bundler-cache: true
|
78
|
+
|
79
|
+
- name: Execute tests
|
80
|
+
run: bundle exec rake spec
|
81
|
+
|
82
|
+
- name: Upload coverage reports to Codecov
|
83
|
+
uses: codecov/codecov-action@v3
|
data/.gitignore
CHANGED
data/.readthedocs.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
version: 2
|
2
|
+
|
3
|
+
build:
|
4
|
+
os: "ubuntu-22.04"
|
5
|
+
tools:
|
6
|
+
python: "3.11"
|
7
|
+
|
8
|
+
# Build from the docs/ directory with Sphinx
|
9
|
+
sphinx:
|
10
|
+
configuration: docs/source/conf.py
|
11
|
+
|
12
|
+
# Explicitly set the version of Python and its requirements
|
13
|
+
python:
|
14
|
+
install:
|
15
|
+
- requirements: docs/requirements.txt
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# This is an example RuboCop configuration file with some commonly used options.
|
2
|
+
|
3
|
+
# Run RuboCop on all Ruby files, except those in `vendor` and `node_modules` directories
|
4
|
+
AllCops:
|
5
|
+
Exclude:
|
6
|
+
- 'vendor/**/*'
|
7
|
+
- 'node_modules/**/*'
|
8
|
+
- 'Vagrantfile'
|
9
|
+
TargetRubyVersion: 3.0
|
10
|
+
|
11
|
+
Style/FrozenStringLiteralComment:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/Documentation:
|
15
|
+
Exclude:
|
16
|
+
- '**/*.rb'
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Lint/ConstantDefinitionInBlock:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/ClassAndModuleChildren:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/BlockLength:
|
26
|
+
Max: 650
|
27
|
+
|
28
|
+
Metrics/MethodLength:
|
29
|
+
Max: 150
|
30
|
+
|
31
|
+
Metrics/ClassLength:
|
32
|
+
Max: 200
|
33
|
+
|
34
|
+
Metrics/ModuleLength:
|
35
|
+
Max: 200
|
36
|
+
|
37
|
+
Metrics/AbcSize:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Metrics/PerceivedComplexity:
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
Metrics/CyclomaticComplexity:
|
44
|
+
Enabled: false
|
45
|
+
|
46
|
+
Metrics/BlockNesting:
|
47
|
+
Enabled: false
|
48
|
+
|
49
|
+
Naming/FileName:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/activerecord-multi-tenant.rb'
|
data/Appraisals
CHANGED
@@ -1,15 +1,3 @@
|
|
1
|
-
appraise 'rails-5.2' do
|
2
|
-
gem 'rails', '~> 5.2.0'
|
3
|
-
gem 'i18n', '~> 0.9.5'
|
4
|
-
gem 'nokogiri', '~> 1.7.1'
|
5
|
-
gem 'nio4r', '~> 2.3.1'
|
6
|
-
gem 'sprockets', '~> 3.7.1'
|
7
|
-
gem 'byebug', '~> 11.0'
|
8
|
-
gem 'rake', '12.0.0'
|
9
|
-
gem 'redis', '3.3.3'
|
10
|
-
gem 'pry-byebug', '3.9.0'
|
11
|
-
end
|
12
|
-
|
13
1
|
appraise 'rails-6.0' do
|
14
2
|
gem 'rails', '~> 6.0.3'
|
15
3
|
end
|
@@ -22,16 +10,8 @@ appraise 'rails-7.0' do
|
|
22
10
|
gem 'rails', '~> 7.0.0'
|
23
11
|
end
|
24
12
|
|
25
|
-
appraise '
|
26
|
-
gem '
|
27
|
-
gem 'i18n', '~> 0.9.5'
|
28
|
-
gem 'nokogiri', '~> 1.7.1'
|
29
|
-
gem 'nio4r', '~> 2.3.1'
|
30
|
-
gem 'sprockets', '~> 3.7.1'
|
31
|
-
gem 'byebug', '~> 11.0'
|
32
|
-
gem 'rake', '12.0.0'
|
33
|
-
gem 'redis', '3.3.3'
|
34
|
-
gem 'pry-byebug', '3.9.0'
|
13
|
+
appraise 'rails-7.1' do
|
14
|
+
gem 'rails', '~> 7.1.0.beta1'
|
35
15
|
end
|
36
16
|
|
37
17
|
appraise 'active-record-6.0' do
|
@@ -45,3 +25,7 @@ end
|
|
45
25
|
appraise 'active-record-7.0' do
|
46
26
|
gem 'activerecord', '~> 7.0.0'
|
47
27
|
end
|
28
|
+
|
29
|
+
appraise 'active-record-7.1' do
|
30
|
+
gem 'activerecord', '~> 7.1.0.beta1'
|
31
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,47 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.4.0 2023-06-05
|
4
|
+
* Adds citus 12 to test matrix (#210)
|
5
|
+
* Adds Support for rails 7.1 (#208)
|
6
|
+
* Fix missing scope in habtm.rb (#207)
|
7
|
+
* Update logic inside the tenant_klass_defined? method (#202)
|
8
|
+
|
9
|
+
## 2.3.0 2023-06-05
|
10
|
+
* Adds has_and_belongs_to_many feature with tenant (#193)
|
11
|
+
* Removes eol ruby versions
|
12
|
+
* Adds documentation in ReadTheDocs platform (#196)
|
13
|
+
* Organizes badges in documentation and README.md (#197)
|
14
|
+
* Wrap ActiveRecord::Base with ActiveSupport.on_load (#199)
|
15
|
+
|
16
|
+
## 2.2.0 2022-12-06
|
17
|
+
* Handle changing tenant from `nil` to a value [#173](https://github.com/citusdata/activerecord-multi-tenant/pull/173)
|
18
|
+
* Allow Partitioned tables to be created without a primary key [#172](https://github.com/citusdata/activerecord-multi-tenant/pull/172)
|
19
|
+
* Only attempt to reload with MultiTenant when parition_key is present [#175](https://github.com/citusdata/activerecord-multi-tenant/pull/175)
|
20
|
+
* Remove support for Ruby 2.5 & ActiveRecord 5.2
|
21
|
+
|
22
|
+
## 2.1.6 2022-11-23
|
23
|
+
* Fix undefined wrap_methods error & wrap_methods version check [#170](https://github.com/citusdata/activerecord-multi-tenant/pull/170)
|
24
|
+
|
25
|
+
## 2.1.5 2022-11-20
|
26
|
+
* Fix `MultiTenant.without` codegen bug in Rails 6.1+ [#168](https://github.com/citusdata/activerecord-multi-tenant/pull/168)
|
27
|
+
|
28
|
+
## 2.1.4 2022-11-03
|
29
|
+
* Fixes #166 where db:schema:dump is broken when using this gem with MySQL [#167](https://github.com/citusdata/activerecord-multi-tenant/pull/167)
|
30
|
+
|
31
|
+
## 2.1.3 2022-10-27
|
32
|
+
* Error when calling a method that takes keyword arguments with MultiTenant.wrap_methods [#164](https://github.com/citusdata/activerecord-multi-tenant/pull/164)
|
33
|
+
|
34
|
+
## 2.1.2 2022-10-26
|
35
|
+
* Fixes issue when wraping methods that require a block [#162](https://github.com/citusdata/activerecord-multi-tenant/pull/162)
|
36
|
+
|
37
|
+
## 2.1.1 2022-10-20
|
38
|
+
* Fix query building for models with mismatched partition_keys [#150](https://github.com/citusdata/activerecord-multi-tenant/pull/150)
|
39
|
+
* Identify tenant even if class name is nonstandard [#152](https://github.com/citusdata/activerecord-multi-tenant/pull/152)
|
40
|
+
* Add current_tenant_id to WHERE clauses when calling methods on activerecord instance or its associations [#154](https://github.com/citusdata/activerecord-multi-tenant/pull/154)
|
41
|
+
* Make create_distributed_table, create_reference_table reversible & add ruby wrapper for rebalance_table_shards [#155](https://github.com/citusdata/activerecord-multi-tenant/pull/155)
|
42
|
+
* Support create_distributed_table, create_reference_table in schema.rb [#156](https://github.com/citusdata/activerecord-multi-tenant/pull/156)
|
43
|
+
* Add client and server sidekiq middleware to sidekiq middleware chain [#158](https://github.com/citusdata/activerecord-multi-tenant/pull/158)
|
44
|
+
|
3
45
|
## 2.0.0 2022-05-19
|
4
46
|
|
5
47
|
* Replace RequestStore with CurrentAttributes [#139](https://github.com/citusdata/activerecord-multi-tenant/pull/139)
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# activerecord-multi-tenant
|
1
|
+
# activerecord-multi-tenant
|
2
|
+
[![Build Status](https://github.com/citusdata/activerecord-multi-tenant/actions/workflows/active-record-multi-tenant-tests.yml/badge.svg)](https://github.com/citusdata/activerecord-multi-tenant/actions/workflows/active-record-multi-tenant-tests.yml) [![codecov](https://codecov.io/gh/citusdata/activerecord-multi-tenant/branch/master/graph/badge.svg?token=rw0TsEk4Ld)](https://codecov.io/gh/citusdata/activerecord-multi-tenant) [ ![Gems Version](https://img.shields.io/gem/v/activerecord-multi-tenant.svg)](https://rubygems.org/gems/activerecord-multi-tenant)[ ![Gem Download Count](https://img.shields.io/gem/dt/activerecord-multi-tenant.svg)](https://rubygems.org/gems/activerecord-multi-tenant) [![Documentation Status](https://readthedocs.org/projects/activerecord-multi-tenant/badge/?version=latest)](https://activerecord-multi-tenant.readthedocs.io/en/latest/?badge=latest)
|
2
3
|
|
3
4
|
Introduction Post: https://www.citusdata.com/blog/2017/01/05/easily-scale-out-multi-tenant-apps/
|
4
5
|
|
@@ -16,7 +17,7 @@ gem 'activerecord-multi-tenant'
|
|
16
17
|
|
17
18
|
## Supported Rails versions
|
18
19
|
|
19
|
-
All Ruby on Rails versions starting with
|
20
|
+
All Ruby on Rails versions starting with 6.0 or newer (up to 7.0) are supported.
|
20
21
|
|
21
22
|
This gem only supports ActiveRecord (the Rails default ORM), and not alternative ORMs like Sequel.
|
22
23
|
|
data/Rakefile
CHANGED
@@ -1,28 +1,34 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
2
2
|
require 'activerecord-multi-tenant/version'
|
3
3
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'activerecord-multi-tenant'
|
6
|
+
spec.version = MultiTenant::VERSION
|
7
|
+
spec.summary = 'ActiveRecord/Rails integration for multi-tenant databases, '\
|
8
|
+
'in particular the Citus extension for PostgreSQL'
|
9
|
+
spec.description = ''
|
10
|
+
spec.authors = ['Citus Data']
|
11
|
+
spec.email = 'engage@citusdata.com'
|
12
|
+
spec.required_ruby_version = '>= 3.0.0'
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
spec.files = `git ls-files`.split("\n")
|
15
|
+
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
spec.require_paths = ['lib']
|
17
|
+
spec.homepage = 'https://github.com/citusdata/activerecord-multi-tenant'
|
18
|
+
spec.license = 'MIT'
|
17
19
|
|
18
|
-
|
20
|
+
spec.add_dependency 'rails', '>= 6'
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
spec.add_development_dependency 'anbt-sql-formatter'
|
23
|
+
spec.add_development_dependency 'codecov'
|
24
|
+
spec.add_development_dependency 'pg'
|
25
|
+
spec.add_development_dependency 'pry'
|
26
|
+
spec.add_development_dependency 'pry-byebug'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec', '>= 3.0'
|
29
|
+
spec.add_development_dependency 'rspec-rails'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
31
|
+
spec.add_development_dependency 'sidekiq'
|
32
|
+
|
33
|
+
spec.add_development_dependency 'thor'
|
28
34
|
end
|
data/docker-compose.yml
CHANGED
@@ -2,25 +2,31 @@ version: '2.1'
|
|
2
2
|
|
3
3
|
services:
|
4
4
|
master:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
volumes: ['/var/run/docker.sock:/var/run/docker.sock']
|
13
|
-
depends_on: { master: { condition: service_healthy } }
|
5
|
+
container_name: "${COMPOSE_PROJECT_NAME:-citus}_master"
|
6
|
+
image: 'citusdata/citus:${CITUS_VERSION:-11.2}'
|
7
|
+
ports: [ '5600:5432' ]
|
8
|
+
labels: [ 'com.citusdata.role=Master' ]
|
9
|
+
environment:
|
10
|
+
- POSTGRES_HOST_AUTH_METHOD=trust
|
11
|
+
command: -c fsync=off -c full_page_writes=off
|
14
12
|
worker1:
|
15
|
-
image: 'citusdata/citus
|
16
|
-
|
13
|
+
image: 'citusdata/citus:${CITUS_VERSION:-11.2}'
|
14
|
+
ports: [ '5601:5432' ]
|
15
|
+
labels: [ 'com.citusdata.role=Worker' ]
|
17
16
|
depends_on: { manager: { condition: service_healthy } }
|
17
|
+
environment:
|
18
|
+
- POSTGRES_HOST_AUTH_METHOD=trust
|
19
|
+
command: -c fsync=off -c full_page_writes=off
|
18
20
|
worker2:
|
19
|
-
image: 'citusdata/citus
|
20
|
-
|
21
|
+
image: 'citusdata/citus:${CITUS_VERSION:-11.2}'
|
22
|
+
ports: [ '5602:5432' ]
|
23
|
+
labels: [ 'com.citusdata.role=Worker' ]
|
21
24
|
depends_on: { manager: { condition: service_healthy } }
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
environment:
|
26
|
+
- POSTGRES_HOST_AUTH_METHOD=trust
|
27
|
+
command: -c fsync=off -c full_page_writes=off
|
28
|
+
manager:
|
29
|
+
container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager"
|
30
|
+
image: 'citusdata/membership-manager:0.2.0'
|
31
|
+
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
|
32
|
+
depends_on: { master: { condition: service_healthy } }
|
data/docs/.gitignore
ADDED
data/docs/Makefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
2
|
+
#
|
3
|
+
|
4
|
+
# You can set these variables from the command line, and also
|
5
|
+
# from the environment for the first two.
|
6
|
+
SPHINXOPTS ?=
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
8
|
+
SOURCEDIR = source
|
9
|
+
BUILDDIR = build
|
10
|
+
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
12
|
+
help:
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
14
|
+
|
15
|
+
.PHONY: help Makefile
|
16
|
+
|
17
|
+
# New target that executes the bash script before calling the original target
|
18
|
+
build-docs: pre-build # Change 'html' to the target you want to execute
|
19
|
+
|
20
|
+
pre-build:
|
21
|
+
# Execute your bash script here
|
22
|
+
bash api-reference.sh
|
23
|
+
|
24
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
25
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
26
|
+
html:
|
27
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
28
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This script is used to generate the API reference documentation for the
|
4
|
+
# project. It is intended to be run from the root of the project directory.
|
5
|
+
# It requires the following tools to be installed:
|
6
|
+
# - yard (gem install yard)
|
7
|
+
echo "Generating API reference documentation..."
|
8
|
+
echo "Pwd: $(pwd)"
|
9
|
+
cd ..
|
10
|
+
yard doc --output-dir docs/source/_static/api-reference
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# This file is autogenerated by pip-compile with Python 3.10
|
3
|
+
# by the following command:
|
4
|
+
#
|
5
|
+
# pip-compile requirements.in
|
6
|
+
#
|
7
|
+
alabaster==0.7.13
|
8
|
+
# via sphinx
|
9
|
+
babel==2.12.1
|
10
|
+
# via sphinx
|
11
|
+
certifi==2023.7.22
|
12
|
+
# via requests
|
13
|
+
charset-normalizer==3.1.0
|
14
|
+
# via requests
|
15
|
+
docutils==0.18.1
|
16
|
+
# via
|
17
|
+
# sphinx
|
18
|
+
# sphinx-rtd-theme
|
19
|
+
idna==3.4
|
20
|
+
# via requests
|
21
|
+
imagesize==1.4.1
|
22
|
+
# via sphinx
|
23
|
+
jinja2==3.1.2
|
24
|
+
# via sphinx
|
25
|
+
markupsafe==2.1.2
|
26
|
+
# via jinja2
|
27
|
+
packaging==23.1
|
28
|
+
# via sphinx
|
29
|
+
pygments==2.15.1
|
30
|
+
# via sphinx
|
31
|
+
readthedocs-sphinx-search==0.3.1
|
32
|
+
# via -r requirements.in
|
33
|
+
requests==2.31.0
|
34
|
+
# via sphinx
|
35
|
+
snowballstemmer==2.2.0
|
36
|
+
# via sphinx
|
37
|
+
sphinx==6.2.1
|
38
|
+
# via
|
39
|
+
# -r requirements.in
|
40
|
+
# sphinx-rtd-theme
|
41
|
+
# sphinxcontrib-jquery
|
42
|
+
# sphinxnotes-strike
|
43
|
+
sphinx-rtd-theme==1.2.1
|
44
|
+
# via -r requirements.in
|
45
|
+
sphinxcontrib-applehelp==1.0.4
|
46
|
+
# via sphinx
|
47
|
+
sphinxcontrib-devhelp==1.0.2
|
48
|
+
# via sphinx
|
49
|
+
sphinxcontrib-htmlhelp==2.0.1
|
50
|
+
# via sphinx
|
51
|
+
sphinxcontrib-jquery==4.1
|
52
|
+
# via sphinx-rtd-theme
|
53
|
+
sphinxcontrib-jsmath==1.0.1
|
54
|
+
# via sphinx
|
55
|
+
sphinxcontrib-qthelp==1.0.3
|
56
|
+
# via sphinx
|
57
|
+
sphinxcontrib-serializinghtml==1.1.5
|
58
|
+
# via sphinx
|
59
|
+
sphinxnotes-strike==1.2
|
60
|
+
# via -r requirements.in
|
61
|
+
urllib3==2.0.2
|
62
|
+
# via requests
|