active_record_shards 3.3.0 → 3.3.2
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/README.md +3 -3
- data/lib/active_record_shards/default_slave_patches.rb +3 -0
- data/lib/active_record_shards/tasks.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5523197a8500c9479196fe307498dd2f8ccfbef2
|
4
|
+
data.tar.gz: 5d70fe07412aa283dee579008f34174fbbf7e582
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d679078d284eec8e16e670c7425e0291319f8a608e84b8a93b3e0cecfd0db984bdce655092121fafaabf67c1d720d8ef99c4ae1205eaf7efc056c161b802855
|
7
|
+
data.tar.gz: 30070b0b63f03a7f4500a5368f33de1ef5a22335539b11dbf5c5d7a00e1896811cbe78793b1df9466ff9580fd5dab9eb253bac5d796cab6f7ed73a5d896f2a51
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# ActiveRecord Shards
|
2
2
|
|
3
3
|
ActiveRecord Shards is an extension for ActiveRecord that provides support for sharded database and slaves. Basically it is just a nice way to
|
4
|
-
switch between database
|
4
|
+
switch between database connections. We've made the implementation very small, and have tried not to reinvent any wheels already present in ActiveRecord.
|
5
5
|
|
6
|
-
ActiveRecord Shards has used and tested on Rails
|
6
|
+
ActiveRecord Shards has used and tested on Rails 3.0.x, 3.2.x, and 4.1.x and has in some form or another been used in production on a large rails app for
|
7
7
|
more than a year.
|
8
8
|
|
9
9
|
## Installation
|
@@ -38,7 +38,7 @@ Add the slave and shard configuration to config/database.yml:
|
|
38
38
|
slave:
|
39
39
|
host: db_shard2_slave
|
40
40
|
|
41
|
-
basically connections inherit configuration from the parent
|
41
|
+
basically connections inherit configuration from the parent configuration file.
|
42
42
|
|
43
43
|
## Usage
|
44
44
|
|
@@ -124,6 +124,9 @@ module ActiveRecordShards
|
|
124
124
|
def model.on_slave_by_default?
|
125
125
|
left_reflection.klass.on_slave_by_default?
|
126
126
|
end
|
127
|
+
|
128
|
+
# also transfer the sharded-ness of the left table to the join model
|
129
|
+
model.not_sharded if !model.left_reflection.klass.is_sharded?
|
127
130
|
model
|
128
131
|
end
|
129
132
|
end
|
@@ -46,7 +46,11 @@ namespace :db do
|
|
46
46
|
desc "Raises an error if there are pending migrations"
|
47
47
|
task :abort_if_pending_migrations => :environment do
|
48
48
|
if defined? ActiveRecord
|
49
|
-
|
49
|
+
if Rails::VERSION::MAJOR >= 4
|
50
|
+
pending_migrations = ActiveRecord::Base.on_shard(nil) { ActiveRecord::Migrator.open(ActiveRecord::Migrator.migrations_paths).pending_migrations }
|
51
|
+
else
|
52
|
+
pending_migrations = ActiveRecord::Base.on_shard(nil) { ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations }
|
53
|
+
end
|
50
54
|
|
51
55
|
if pending_migrations.any?
|
52
56
|
puts "You have #{pending_migrations.size} pending migrations:"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_shards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-01-
|
13
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|