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.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/active-record-multi-tenant-tests.yml +83 -0
  3. data/.gitignore +6 -0
  4. data/.readthedocs.yaml +15 -0
  5. data/.rspec +0 -0
  6. data/.rubocop.yml +51 -0
  7. data/Appraisals +6 -22
  8. data/CHANGELOG.md +42 -0
  9. data/Gemfile +3 -1
  10. data/LICENSE +0 -0
  11. data/README.md +3 -2
  12. data/Rakefile +1 -1
  13. data/activerecord-multi-tenant.gemspec +28 -22
  14. data/docker-compose.yml +24 -18
  15. data/docs/.gitignore +3 -0
  16. data/docs/Makefile +28 -0
  17. data/docs/api-reference.sh +10 -0
  18. data/docs/requirements.in +4 -0
  19. data/docs/requirements.txt +62 -0
  20. data/docs/source/_static/api-reference/ActiveRecord/Associations/Association.html +285 -0
  21. data/docs/source/_static/api-reference/ActiveRecord/Associations/ClassMethods.html +255 -0
  22. data/docs/source/_static/api-reference/ActiveRecord/Associations.html +117 -0
  23. data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters/SchemaStatements.html +232 -0
  24. data/docs/source/_static/api-reference/ActiveRecord/ConnectionAdapters.html +126 -0
  25. data/docs/source/_static/api-reference/ActiveRecord/QueryMethods.html +336 -0
  26. data/docs/source/_static/api-reference/ActiveRecord/SchemaDumper.html +121 -0
  27. data/docs/source/_static/api-reference/ActiveRecord.html +130 -0
  28. data/docs/source/_static/api-reference/MultiTenant/ArelTenantVisitor.html +755 -0
  29. data/docs/source/_static/api-reference/MultiTenant/ArelVisitorsDepthFirst.html +208 -0
  30. data/docs/source/_static/api-reference/MultiTenant/BaseTenantEnforcementClause.html +462 -0
  31. data/docs/source/_static/api-reference/MultiTenant/Context.html +659 -0
  32. data/docs/source/_static/api-reference/MultiTenant/ControllerExtensions.html +202 -0
  33. data/docs/source/_static/api-reference/MultiTenant/CopyFromClient.html +186 -0
  34. data/docs/source/_static/api-reference/MultiTenant/CopyFromClientHelper.html +362 -0
  35. data/docs/source/_static/api-reference/MultiTenant/Current.html +124 -0
  36. data/docs/source/_static/api-reference/MultiTenant/DatabaseStatements.html +366 -0
  37. data/docs/source/_static/api-reference/MultiTenant/FastTruncate.html +226 -0
  38. data/docs/source/_static/api-reference/MultiTenant/MigrationExtensions.html +554 -0
  39. data/docs/source/_static/api-reference/MultiTenant/MissingTenantError.html +124 -0
  40. data/docs/source/_static/api-reference/MultiTenant/ModelExtensionsClassMethods.html +492 -0
  41. data/docs/source/_static/api-reference/MultiTenant/QueryMonitor.html +257 -0
  42. data/docs/source/_static/api-reference/MultiTenant/Table.html +419 -0
  43. data/docs/source/_static/api-reference/MultiTenant/TenantEnforcementClause.html +148 -0
  44. data/docs/source/_static/api-reference/MultiTenant/TenantIsImmutable.html +135 -0
  45. data/docs/source/_static/api-reference/MultiTenant/TenantJoinEnforcementClause.html +310 -0
  46. data/docs/source/_static/api-reference/MultiTenant/TenantValueVisitor.html +239 -0
  47. data/docs/source/_static/api-reference/MultiTenant.html +1454 -0
  48. data/docs/source/_static/api-reference/MultiTenantFindBy.html +180 -0
  49. data/docs/source/_static/api-reference/Sidekiq/Client.html +302 -0
  50. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Client.html +217 -0
  51. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant/Server.html +219 -0
  52. data/docs/source/_static/api-reference/Sidekiq/Middleware/MultiTenant.html +126 -0
  53. data/docs/source/_static/api-reference/Sidekiq.html +126 -0
  54. data/docs/source/_static/api-reference/_index.html +399 -0
  55. data/docs/source/_static/api-reference/class_list.html +51 -0
  56. data/docs/source/_static/api-reference/css/common.css +1 -0
  57. data/docs/source/_static/api-reference/css/full_list.css +58 -0
  58. data/docs/source/_static/api-reference/css/style.css +497 -0
  59. data/docs/source/_static/api-reference/file.README.html +167 -0
  60. data/docs/source/_static/api-reference/file_list.html +56 -0
  61. data/docs/source/_static/api-reference/frames.html +17 -0
  62. data/docs/source/_static/api-reference/index.html +167 -0
  63. data/docs/source/_static/api-reference/js/app.js +314 -0
  64. data/docs/source/_static/api-reference/js/full_list.js +216 -0
  65. data/docs/source/_static/api-reference/js/jquery.js +4 -0
  66. data/docs/source/_static/api-reference/method_list.html +715 -0
  67. data/docs/source/_static/api-reference/top-level-namespace.html +126 -0
  68. data/docs/source/_templates/.gitignore +4 -0
  69. data/docs/source/api-reference.rst +8 -0
  70. data/docs/source/appendix.rst +26 -0
  71. data/docs/source/changelog.rst +8 -0
  72. data/docs/source/community-and-support.rst +26 -0
  73. data/docs/source/conf.py +30 -0
  74. data/docs/source/contributing.rst +70 -0
  75. data/docs/source/getting-started.rst +37 -0
  76. data/docs/source/guides-and-tutorials.rst +129 -0
  77. data/docs/source/index.rst +54 -0
  78. data/docs/source/introduction.rst +33 -0
  79. data/docs/source/license.rst +22 -0
  80. data/docs/source/troubleshooting.rst +41 -0
  81. data/docs/source/usage-guide.rst +59 -0
  82. data/lib/activerecord-multi-tenant/arel_visitors_depth_first.rb +183 -174
  83. data/lib/activerecord-multi-tenant/controller_extensions.rb +15 -4
  84. data/lib/activerecord-multi-tenant/copy_from_client.rb +4 -0
  85. data/lib/activerecord-multi-tenant/fast_truncate.rb +4 -2
  86. data/lib/activerecord-multi-tenant/habtm.rb +50 -0
  87. data/lib/activerecord-multi-tenant/migrations.rb +87 -10
  88. data/lib/activerecord-multi-tenant/model_extensions.rb +96 -38
  89. data/lib/activerecord-multi-tenant/multi_tenant.rb +83 -24
  90. data/lib/activerecord-multi-tenant/query_monitor.rb +21 -5
  91. data/lib/activerecord-multi-tenant/query_rewriter.rb +121 -87
  92. data/lib/activerecord-multi-tenant/sidekiq.rb +46 -19
  93. data/lib/activerecord-multi-tenant/table_node.rb +13 -0
  94. data/lib/activerecord-multi-tenant/version.rb +1 -1
  95. data/lib/activerecord-multi-tenant.rb +3 -13
  96. data/lib/activerecord_multi_tenant.rb +13 -0
  97. data/spec/activerecord-multi-tenant/associations_spec.rb +42 -0
  98. data/spec/activerecord-multi-tenant/controller_extensions_spec.rb +3 -2
  99. data/spec/activerecord-multi-tenant/fast_truncate_spec.rb +8 -6
  100. data/spec/activerecord-multi-tenant/model_extensions_spec.rb +300 -147
  101. data/spec/activerecord-multi-tenant/multi_tenant_spec.rb +69 -13
  102. data/spec/activerecord-multi-tenant/query_rewriter_spec.rb +60 -59
  103. data/spec/activerecord-multi-tenant/record_callback_spec.rb +0 -0
  104. data/spec/activerecord-multi-tenant/record_finding_spec.rb +11 -11
  105. data/spec/activerecord-multi-tenant/record_modifications_spec.rb +23 -4
  106. data/spec/activerecord-multi-tenant/sidekiq_spec.rb +10 -10
  107. data/spec/database.yml +0 -0
  108. data/spec/schema.rb +20 -3
  109. data/spec/spec_helper.rb +46 -17
  110. data/spec/support/format_sql.rb +20 -0
  111. metadata +134 -32
  112. data/.github/workflows/CI.yml +0 -73
  113. data/gemfiles/.bundle/config +0 -2
  114. data/gemfiles/active_record_5.2.3.gemfile +0 -16
  115. data/gemfiles/active_record_5.2.gemfile +0 -16
  116. data/gemfiles/active_record_6.0.gemfile +0 -8
  117. data/gemfiles/active_record_6.1.gemfile +0 -8
  118. data/gemfiles/active_record_7.0.gemfile +0 -8
  119. data/gemfiles/rails_5.2.3.gemfile +0 -16
  120. data/gemfiles/rails_5.2.gemfile +0 -16
  121. data/gemfiles/rails_6.0.gemfile +0 -8
  122. data/gemfiles/rails_6.1.gemfile +0 -8
  123. data/gemfiles/rails_7.0.gemfile +0 -8
  124. data/lib/activerecord-multi-tenant/persistence_extension.rb +0 -13
  125. data/lib/activerecord-multi-tenant/with_lock.rb +0 -15
  126. 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: 457cfac4996b93bb7b0b25cd99c2687f2742a8bc580888008baa4f903255cd74
4
- data.tar.gz: 8c369e04a906752deda52d9b7b78a2377551e4b85f74e3b6d4b0742d30147783
3
+ metadata.gz: f277cdbd6175c03dcbbca13e06220f5612fdf40cefb539a3619b4afa0077d369
4
+ data.tar.gz: bae03db825cc60a9833a2287245b7ff5f62ede9aa67497594e867832a75eaedf
5
5
  SHA512:
6
- metadata.gz: 7715dadcbd9cd13d86135518d3fc62283d9ab85e802016ab1be15fe39d815ec344c1d3e4699f96870b6e50b6d3b66b4a38f780d07ad6d3d4b8e21668deacca18
7
- data.tar.gz: d1d364ebde87012cc5b91a6cf812a1a8cc0f89bb5ee8859b3de01ab0392dc5a62b74a3f93ac721d3e583343b703fc872d73c1f301cff9716e686492f06922d36
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
@@ -4,3 +4,9 @@ pkg/
4
4
  *.*~
5
5
  Gemfile.lock
6
6
  *.gemfile.lock
7
+ .idea/
8
+ .vagrant/
9
+ Vagrantfile
10
+ coverage/
11
+ docs/build/
12
+ .yardoc/
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 'active-record-5.2' do
26
- gem 'activerecord', '~> 5.2.0'
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
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
4
  gem 'appraisal'
5
+ gem 'rubocop', require: false, group: 'test'
6
+ gem 'simplecov'
7
+ gem 'simplecov-cobertura'
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # activerecord-multi-tenant [ ![](https://img.shields.io/gem/v/activerecord-multi-tenant.svg)](https://rubygems.org/gems/activerecord-multi-tenant) [ ![](https://img.shields.io/gem/dt/activerecord-multi-tenant.svg)](https://rubygems.org/gems/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 4.2 or newer (up to 6.0) are supported.
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
@@ -4,4 +4,4 @@ require 'bundler/gem_tasks'
4
4
 
5
5
  require 'rspec/core/rake_task'
6
6
  RSpec::Core::RakeTask.new(:spec)
7
- task :default => :spec
7
+ task default: :spec
@@ -1,28 +1,34 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
2
  require 'activerecord-multi-tenant/version'
3
3
 
4
- Gem::Specification.new do |s|
5
- s.name = 'activerecord-multi-tenant'
6
- s.version = MultiTenant::VERSION
7
- s.summary = 'ActiveRecord/Rails integration for multi-tenant databases, in particular the Citus extension for PostgreSQL'
8
- s.description = ''
9
- s.authors = ['Citus Data']
10
- s.email = 'engage@citusdata.com'
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
- s.files = `git ls-files`.split("\n")
13
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
14
- s.require_paths = ['lib']
15
- s.homepage = 'https://github.com/citusdata/activerecord-multi-tenant'
16
- s.license = 'MIT'
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
- s.add_dependency 'rails', '>= 5.2'
20
+ spec.add_dependency 'rails', '>= 6'
19
21
 
20
- s.add_development_dependency 'rspec', '>= 3.0'
21
- s.add_development_dependency 'rspec-rails'
22
- s.add_development_dependency 'pg'
23
- s.add_development_dependency 'rake'
24
- s.add_development_dependency 'sidekiq'
25
- s.add_development_dependency 'thor'
26
- s.add_development_dependency 'pry'
27
- s.add_development_dependency 'pry-byebug'
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
- image: 'citusdata/citus:7.5.1'
6
- ports: ['5600:5432']
7
- labels: ['com.citusdata.role=Master']
8
- volumes: ['/var/run/postgresql']
9
- manager:
10
- container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager"
11
- image: 'citusdata/membership-manager:0.1.0'
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:7.5.1'
16
- labels: ['com.citusdata.role=Worker']
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:7.5.1'
20
- labels: ['com.citusdata.role=Worker']
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
- healthcheck:
23
- image: busybox
24
- depends_on:
25
- worker1: { condition: service_healthy }
26
- worker2: { condition: service_healthy }
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
@@ -0,0 +1,3 @@
1
+ # Ignore everything in this directory
2
+ .yardoc/*
3
+
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,4 @@
1
+ sphinxnotes-strike
2
+ sphinx
3
+ sphinx_rtd_theme
4
+ readthedocs-sphinx-search
@@ -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