Skip to content

Commit

Permalink
Merge pull request #1 from citusdata/master
Browse files Browse the repository at this point in the history
Just want to sync the latest version
  • Loading branch information
kolomoiets-dev-pro authored Dec 20, 2023
2 parents 5bc94d3 + 20d09a8 commit 9c16097
Show file tree
Hide file tree
Showing 126 changed files with 15,832 additions and 2,218 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/active-record-multi-tenant-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Active Record Multi-Tenant Tests

env:
CI: true
on:
push:
branches:
- "**"
pull_request:
types: [ opened, reopened, synchronize ]

jobs:

static-checks:
runs-on: ubuntu-latest
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- uses: actions/checkout@v3
- name: Rubocop static code analysis
run: |
gem install rubocop
rubocop
doc_checks:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
- name: Install python dependencies
run: |
pip install -r docs/requirements.txt
- name: Documentation Checks
run: |
cd docs
sphinx-build -W -b html source builds
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '3.0'
- '3.1'
- '3.2'
appraisal:
- rails-6.0
- rails-6.1
- rails-7.0
- rails-7.1
- active-record-6.0
- active-record-6.1
- active-record-7.0
- active-record-7.1
citus_version:
- '10'
- '11'
- '12'

name: Ruby ${{ matrix.ruby }}/${{ matrix.gemfile }} / Citus ${{ matrix.citus_version }}
env:
APPRAISAL: ${{ matrix.appraisal }}
CITUS_VERSION: ${{ matrix.citus_version }}
steps:
- uses: actions/checkout@v3

- name: Start Citus Database environment
run: docker-compose up -d

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Execute tests
run: bundle exec rake spec

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ spec/debug.log
pkg/
*.rb#
*.*~
Gemfile.lock
*.gemfile.lock
.idea/
.vagrant/
Vagrantfile
coverage/
docs/build/
.yardoc/
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements.txt
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--force-color
59 changes: 59 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This is an example RuboCop configuration file with some commonly used options.

# Run RuboCop on all Ruby files, except those in `vendor` and `node_modules` directories
AllCops:
Exclude:
- 'vendor/**/*'
- 'node_modules/**/*'
- 'Vagrantfile'
TargetRubyVersion: 3.0
SuggestExtensions: false
NewCops: enable

Gemspec/DevelopmentDependencies:
Enabled: false

Lint/ConstantDefinitionInBlock:
Enabled: false

Lint/EmptyBlock:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/Documentation:
Exclude:
- '**/*.rb'
Enabled: false

Style/DocumentDynamicEvalDefinition:
Enabled: false

Metrics/BlockLength:
Max: 650

Metrics/MethodLength:
Max: 150

Metrics/ClassLength:
Max: 200

Metrics/ModuleLength:
Max: 200

Metrics/AbcSize:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Naming/FileName:
Exclude:
- 'lib/activerecord-multi-tenant.rb'
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

36 changes: 15 additions & 21 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
appraise 'rails-5.2' do
gem 'rails', '~> 5.2.0'
gem 'i18n', '~> 0.9.5'
gem 'nokogiri', '~> 1.7.1'
gem 'nio4r', '~> 2.3.1'
gem 'sprockets', '~> 3.7.1'
gem 'byebug', '~> 11.0'
gem 'rake', '12.0.0'
gem 'redis', '3.3.3'
gem 'pry-byebug', '3.9.0'
end
# frozen_string_literal: true

appraise 'rails-6.0' do
gem 'rails', '~> 6.0.3'
Expand All @@ -18,16 +8,12 @@ appraise 'rails-6.1' do
gem 'rails', '~> 6.1.0'
end

appraise 'active-record-5.2' do
gem 'activerecord', '~> 5.2.0'
gem 'i18n', '~> 0.9.5'
gem 'nokogiri', '~> 1.7.1'
gem 'nio4r', '~> 2.3.1'
gem 'sprockets', '~> 3.7.1'
gem 'byebug', '~> 11.0'
gem 'rake', '12.0.0'
gem 'redis', '3.3.3'
gem 'pry-byebug', '3.9.0'
appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
end

appraise 'active-record-6.0' do
Expand All @@ -37,3 +23,11 @@ end
appraise 'active-record-6.1' do
gem 'activerecord', '~> 6.1.0'
end

appraise 'active-record-7.0' do
gem 'activerecord', '~> 7.0.0'
end

appraise 'active-record-7.1' do
gem 'activerecord', '~> 7.1.0'
end
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Changelog

## 2.4.0 2023-09-22
* Adds citus 12 to test matrix (#210)
* Adds Support for rails 7.1 (#208)
* Fix missing scope in habtm.rb (#207)
* Update logic inside the tenant_klass_defined? method (#202)

## 2.3.0 2023-06-05
* Adds has_and_belongs_to_many feature with tenant (#193)
* Removes eol ruby versions
* Adds documentation in ReadTheDocs platform (#196)
* Organizes badges in documentation and README.md (#197)
* Wrap ActiveRecord::Base with ActiveSupport.on_load (#199)

## 2.2.0 2022-12-06
* Handle changing tenant from `nil` to a value [#173](https://github.com/citusdata/activerecord-multi-tenant/pull/173)
* Allow Partitioned tables to be created without a primary key [#172](https://github.com/citusdata/activerecord-multi-tenant/pull/172)
* Only attempt to reload with MultiTenant when parition_key is present [#175](https://github.com/citusdata/activerecord-multi-tenant/pull/175)
* Remove support for Ruby 2.5 & ActiveRecord 5.2

## 2.1.6 2022-11-23
* Fix undefined wrap_methods error & wrap_methods version check [#170](https://github.com/citusdata/activerecord-multi-tenant/pull/170)

## 2.1.5 2022-11-20
* Fix `MultiTenant.without` codegen bug in Rails 6.1+ [#168](https://github.com/citusdata/activerecord-multi-tenant/pull/168)

## 2.1.4 2022-11-03
* Fixes #166 where db:schema:dump is broken when using this gem with MySQL [#167](https://github.com/citusdata/activerecord-multi-tenant/pull/167)

## 2.1.3 2022-10-27
* Error when calling a method that takes keyword arguments with MultiTenant.wrap_methods [#164](https://github.com/citusdata/activerecord-multi-tenant/pull/164)

## 2.1.2 2022-10-26
* Fixes issue when wraping methods that require a block [#162](https://github.com/citusdata/activerecord-multi-tenant/pull/162)

## 2.1.1 2022-10-20
* Fix query building for models with mismatched partition_keys [#150](https://github.com/citusdata/activerecord-multi-tenant/pull/150)
* Identify tenant even if class name is nonstandard [#152](https://github.com/citusdata/activerecord-multi-tenant/pull/152)
* 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)
* 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)
* Support create_distributed_table, create_reference_table in schema.rb [#156](https://github.com/citusdata/activerecord-multi-tenant/pull/156)
* Add client and server sidekiq middleware to sidekiq middleware chain [#158](https://github.com/citusdata/activerecord-multi-tenant/pull/158)

## 2.0.0 2022-05-19

* Replace RequestStore with CurrentAttributes [#139](https://github.com/citusdata/activerecord-multi-tenant/pull/139)
* Support changing table_name after calling multi_tenant [#128](https://github.com/citusdata/activerecord-multi-tenant/pull/128)
* Allow to use uuid as primary key on partition table [#112](https://github.com/citusdata/activerecord-multi-tenant/pull/112)
* Support latest Rails 5.2 [#145](https://github.com/citusdata/activerecord-multi-tenant/pull/145)
* Support optional: true for belongs_to [#147](https://github.com/citusdata/activerecord-multi-tenant/pull/147)


## 1.2.0 2022-03-29

* Test Rails 7 & Ruby 3
* Fix regression in 1.1.1 involving deleted tenants [#123](https://github.com/citusdata/activerecord-multi-tenant/pull/123)
* Fix incorrect SQL generated when joining two models and one has a default scope [#132](https://github.com/citusdata/activerecord-multi-tenant/pull/132)
* Update for Rails 5+ removal of type_cast_for_database [#135](https://github.com/citusdata/activerecord-multi-tenant/pull/135)


## 1.1.1 2021-01-15

* Add support for Rails 6.1 [#108](https://github.com/citusdata/activerecord-multi-tenant/pull/108)
Expand Down
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'appraisal'
gem 'rubocop', require: false, group: 'test'
gem 'simplecov'
gem 'simplecov-cobertura'
Loading

0 comments on commit 9c16097

Please sign in to comment.