activerecord-multi-tenant 1.0.3 → 1.0.4
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/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/gemfiles/active_record_5.1.gemfile.lock +1 -1
- data/gemfiles/active_record_5.2.gemfile.lock +1 -1
- data/gemfiles/active_record_6.0.gemfile.lock +1 -1
- data/gemfiles/rails_4.2.gemfile.lock +1 -1
- data/gemfiles/rails_5.0.gemfile.lock +1 -1
- data/gemfiles/rails_5.1.gemfile.lock +1 -1
- data/gemfiles/rails_5.2.gemfile.lock +1 -1
- data/gemfiles/rails_6.0.gemfile.lock +1 -1
- data/lib/activerecord-multi-tenant/persistence_extension.rb +1 -1
- data/lib/activerecord-multi-tenant/version.rb +1 -1
- data/spec/activerecord-multi-tenant/record_modifications_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ba6283cdc0a3a6156de1ed6e48674650769dd98a563175e3f0f6ad145e948a1
|
4
|
+
data.tar.gz: 4e60b1920f1b14a6707adf28fbd15135830a46a8085c07912fb5b190d7b677e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84f4b35e8525f88193b08c719abce5c75d085bbfca9f517cc090d0a604cd435a23bf565c66e91c1cae30e45c06c92d7407829a0659a88843757baa54e0e6dd49
|
7
|
+
data.tar.gz: 3495d94157cc8dc9528d55405eca44fd7c077fbd06bf841b915cc02e8d2940abff626d652802ff15b23f8a9192d8af76cbd038128be1a2a0369fba2f213458d0
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
3
|
|
4
|
+
## 1.0.4 2019-10-30
|
5
|
+
|
6
|
+
* Fix bug introduced in 1.0.3 for delete when table is reference or not distributed
|
7
|
+
|
8
|
+
|
9
|
+
## 1.0.3 2019-10-28
|
10
|
+
|
11
|
+
* Ensure that when using object.delete, we set the tenant
|
12
|
+
|
13
|
+
|
4
14
|
## 1.0.2 2019-09-20
|
5
15
|
|
6
16
|
* Compatibility with rails 6
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ module ActiveRecord
|
|
3
3
|
alias :delete_orig :delete
|
4
4
|
|
5
5
|
def delete
|
6
|
-
if persisted? && MultiTenant.current_tenant_id.nil?
|
6
|
+
if MultiTenant.multi_tenant_model_for_table(self.class.table_name).present? && persisted? && MultiTenant.current_tenant_id.nil?
|
7
7
|
MultiTenant.with(self.public_send(self.class.partition_key)) { delete_orig }
|
8
8
|
else
|
9
9
|
delete_orig
|
@@ -52,7 +52,20 @@ describe MultiTenant, 'Record modifications' do
|
|
52
52
|
MultiTenant.with(account2) do
|
53
53
|
expect(Project.where(id: project2.id).first).to be_present
|
54
54
|
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'test delete for reference tables' do
|
58
|
+
category1 = Category.create! name: 'Category 1'
|
59
|
+
expect(Category.count).to eq(1)
|
60
|
+
category1.delete
|
61
|
+
expect(Category.count).to eq(0)
|
62
|
+
end
|
55
63
|
|
64
|
+
it 'test delete for non distributed tables' do
|
65
|
+
unscoped = UnscopedModel.create! name: 'Canada'
|
66
|
+
expect(UnscopedModel.count).to eq(1)
|
67
|
+
unscoped.delete
|
68
|
+
expect(UnscopedModel.count).to eq(0)
|
56
69
|
end
|
57
70
|
|
58
71
|
it 'includes the tenant_id in UPDATEs' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-multi-tenant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Citus Data
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: request_store
|