ar_shard 1.0.0 → 1.1.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/ci.yml +25 -0
- data/CHANGELOG.md +8 -0
- data/README.md +15 -2
- data/ar_shard.gemspec +3 -3
- data/gemfiles/rails_5.gemfile.lock +4 -4
- data/gemfiles/rails_6.gemfile.lock +4 -4
- data/lib/ar_shard/version.rb +1 -1
- metadata +10 -9
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35217aa1fbce62005178fe61b41c70a03cdbaf943f1700bebe92d608d8c521f2
|
|
4
|
+
data.tar.gz: b78dc7bb4e4a7ab7717343eecaac7293e152ed904953c7cb9ebb13bfbd178c92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a0e7dc6cb5fe450771bbb2447bb447cb138f52706f0ddc4c64db7d8b89abfe57522ff9af63bc9e3b69167cf2e96144a1bcf37a7ff73bf87e1e203ccfced50824
|
|
7
|
+
data.tar.gz: 469810a9ac12ccd94ddfb522680230a6f0cbf4e3ebb4fe1c6b877d587fa6ad6e5d12040dfba6070658bb561aa0a54bdf48ae08218115ea10936d1942e3efc572
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
gemfile:
|
|
15
|
+
- gemfiles/rails_5.gemfile
|
|
16
|
+
- gemfiles/rails_6.gemfile
|
|
17
|
+
env:
|
|
18
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: '2.5.3'
|
|
24
|
+
bundler-cache: true
|
|
25
|
+
- run: bundle exec rake test
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
## 1.1.0
|
|
2
|
+
|
|
3
|
+
- Constrained activerecord to `>= 5.2, < 6.1` to match tested versions
|
|
4
|
+
- Documented tested Ruby/ActiveRecord compatibility in README
|
|
5
|
+
|
|
1
6
|
## 1.0.0
|
|
7
|
+
|
|
2
8
|
- Added Rails5 support
|
|
3
9
|
|
|
4
10
|
## 0.2.3
|
|
11
|
+
|
|
5
12
|
- Removed pry require in runtime
|
|
6
13
|
|
|
7
14
|
## 0.2.2
|
|
15
|
+
|
|
8
16
|
- Fixed missing connection if loaded from YAML
|
|
9
17
|
- Added tests for multiple connection switches with another block
|
|
10
18
|
|
data/README.md
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
# AR Shard
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/ar_shard)
|
|
4
|
+
[](https://github.com/noma4i/ar_shard/actions/workflows/ci.yml)
|
|
5
|
+
|
|
3
6
|
AR Shard is non-intrusive extenstion for ActiveRecord to add threadsafe Model based sharding or just multidatabase connection. As this gem uses connection_handlers it can work only with ActiveRecord version 5 and above.
|
|
4
7
|
|
|
8
|
+
## Compatibility
|
|
9
|
+
|
|
10
|
+
This gem was tested against:
|
|
11
|
+
|
|
12
|
+
- Ruby 2.5.3
|
|
13
|
+
- ActiveRecord 5.2.4.3 and 6.0.3.2 (see `Appraisals` and `gemfiles/`)
|
|
14
|
+
|
|
15
|
+
Rails 6.1 reworked `connection_handlers` into its own sharding framework, the same API this gem patches, so versions 6.1 and above were never tested and are not supported. The gemspec enforces `activerecord >= 5.2, < 6.1`.
|
|
16
|
+
|
|
5
17
|
## Features
|
|
18
|
+
|
|
6
19
|
- Multiple Databases support for Rails5
|
|
7
20
|
- Define config as a Proc
|
|
8
21
|
- Shard only part of you ActiveRecord w/o sharing connection
|
|
@@ -10,6 +23,7 @@ AR Shard is non-intrusive extenstion for ActiveRecord to add threadsafe Model ba
|
|
|
10
23
|
- Threadsafe. Battle-tested with Sidekiq and 4 mixed Databases
|
|
11
24
|
|
|
12
25
|
## Limitations
|
|
26
|
+
|
|
13
27
|
- Doesn't care about migrations
|
|
14
28
|
- Due to nature of connection_handlers all DB connections are established at boot time
|
|
15
29
|
- if data structure is different between databases you should use `ModelName.reset_column_information`
|
|
@@ -48,7 +62,7 @@ class ShardRecord < ActiveRecord::Base
|
|
|
48
62
|
end
|
|
49
63
|
```
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
Where `shards.yml` is like:
|
|
52
66
|
|
|
53
67
|
```yaml
|
|
54
68
|
- shard_1:
|
|
@@ -69,7 +83,6 @@ end
|
|
|
69
83
|
pool: 10
|
|
70
84
|
```
|
|
71
85
|
|
|
72
|
-
|
|
73
86
|
given we have models like:
|
|
74
87
|
|
|
75
88
|
```ruby
|
data/ar_shard.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.email = ['noma4i@gmail.com']
|
|
8
8
|
|
|
9
9
|
spec.summary = 'Isolated Multibase Support for ActiveRecord Models with dynamic config'
|
|
10
|
-
spec.description = 'Isolated Multibase Support for ActiveRecord Models with dynamic config'
|
|
10
|
+
spec.description = 'DB Rails Sharding. Isolated Multibase Support for ActiveRecord Models with dynamic config'
|
|
11
11
|
spec.homepage = 'https://github.com/noma4i/ar_shard'
|
|
12
12
|
spec.license = 'MIT'
|
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
|
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
24
|
spec.require_paths = ['lib']
|
|
25
25
|
|
|
26
|
-
spec.add_dependency 'activerecord', ['>= 5.2', '<
|
|
26
|
+
spec.add_dependency 'activerecord', ['>= 5.2', '< 6.1']
|
|
27
27
|
|
|
28
|
-
spec.add_development_dependency 'sqlite3', '~> 1.4'
|
|
28
|
+
spec.add_development_dependency 'sqlite3', '~> 1.4.4'
|
|
29
29
|
spec.add_development_dependency 'appraisal', '~> 2.3'
|
|
30
30
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
ar_shard (1.
|
|
5
|
-
activerecord (>= 5.2, <
|
|
4
|
+
ar_shard (1.1.0)
|
|
5
|
+
activerecord (>= 5.2, < 6.1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -28,7 +28,7 @@ GEM
|
|
|
28
28
|
concurrent-ruby (~> 1.0)
|
|
29
29
|
minitest (5.11.3)
|
|
30
30
|
rake (12.3.3)
|
|
31
|
-
sqlite3 (1.4.
|
|
31
|
+
sqlite3 (1.4.4)
|
|
32
32
|
thor (1.0.1)
|
|
33
33
|
thread_safe (0.3.6)
|
|
34
34
|
tzinfo (1.2.7)
|
|
@@ -43,7 +43,7 @@ DEPENDENCIES
|
|
|
43
43
|
ar_shard!
|
|
44
44
|
minitest (~> 5.0)
|
|
45
45
|
rake (~> 12.0)
|
|
46
|
-
sqlite3 (~> 1.4)
|
|
46
|
+
sqlite3 (~> 1.4.4)
|
|
47
47
|
|
|
48
48
|
BUNDLED WITH
|
|
49
49
|
1.17.3
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ..
|
|
3
3
|
specs:
|
|
4
|
-
ar_shard (1.
|
|
5
|
-
activerecord (>= 5.2, <
|
|
4
|
+
ar_shard (1.1.0)
|
|
5
|
+
activerecord (>= 5.2, < 6.1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
@@ -27,7 +27,7 @@ GEM
|
|
|
27
27
|
concurrent-ruby (~> 1.0)
|
|
28
28
|
minitest (5.11.3)
|
|
29
29
|
rake (12.3.3)
|
|
30
|
-
sqlite3 (1.4.
|
|
30
|
+
sqlite3 (1.4.4)
|
|
31
31
|
thor (1.0.1)
|
|
32
32
|
thread_safe (0.3.6)
|
|
33
33
|
tzinfo (1.2.7)
|
|
@@ -43,7 +43,7 @@ DEPENDENCIES
|
|
|
43
43
|
ar_shard!
|
|
44
44
|
minitest (~> 5.0)
|
|
45
45
|
rake (~> 12.0)
|
|
46
|
-
sqlite3 (~> 1.4)
|
|
46
|
+
sqlite3 (~> 1.4.4)
|
|
47
47
|
|
|
48
48
|
BUNDLED WITH
|
|
49
49
|
1.17.3
|
data/lib/ar_shard/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ar_shard
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Tsirel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '5.2'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '6.1'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,21 +29,21 @@ dependencies:
|
|
|
29
29
|
version: '5.2'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '6.1'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: sqlite3
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
39
|
+
version: 1.4.4
|
|
40
40
|
type: :development
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
46
|
+
version: 1.4.4
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: appraisal
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,15 +58,16 @@ dependencies:
|
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '2.3'
|
|
61
|
-
description: Isolated Multibase Support for ActiveRecord Models
|
|
61
|
+
description: DB Rails Sharding. Isolated Multibase Support for ActiveRecord Models
|
|
62
|
+
with dynamic config
|
|
62
63
|
email:
|
|
63
64
|
- noma4i@gmail.com
|
|
64
65
|
executables: []
|
|
65
66
|
extensions: []
|
|
66
67
|
extra_rdoc_files: []
|
|
67
68
|
files:
|
|
69
|
+
- ".github/workflows/ci.yml"
|
|
68
70
|
- ".gitignore"
|
|
69
|
-
- ".travis.yml"
|
|
70
71
|
- Appraisals
|
|
71
72
|
- CHANGELOG.md
|
|
72
73
|
- Gemfile
|
|
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
107
|
- !ruby/object:Gem::Version
|
|
107
108
|
version: '0'
|
|
108
109
|
requirements: []
|
|
109
|
-
rubygems_version: 3.
|
|
110
|
+
rubygems_version: 3.4.19
|
|
110
111
|
signing_key:
|
|
111
112
|
specification_version: 4
|
|
112
113
|
summary: Isolated Multibase Support for ActiveRecord Models with dynamic config
|