sequel-schema-sharding 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/sequel/schema-sharding/database_manager.rb +4 -2
- data/lib/sequel/schema-sharding/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72d8c926196bde281cfb5dba3a6227639c1c3cdb
|
4
|
+
data.tar.gz: 51db28a22be25d6796a4287c7c3886e50d8f92df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b39019d3b9ff7f93cf9c1810ea87a2835b89e44c0d7bd279f931ace4600b296cb26a2ab88ec73acb1a2f1536f9a96c930f64cfeb6206f09806ca9228bb2e590
|
7
|
+
data.tar.gz: 813908ccaa7724a9cf5974c51047060dd585a04f8beefe80ef0c28e9d7c5e569d9249334197f874a0b4f5891a2c2da9ec5b9ed2346458696a76ff9c9c3a99578
|
data/README.md
CHANGED
@@ -38,6 +38,7 @@ conventions:
|
|
38
38
|
schema_name: "schema_%e_%s"
|
39
39
|
logical_shards:
|
40
40
|
<1..n>: <shard_name>
|
41
|
+
<n+1..m>: <shard_name>
|
41
42
|
physical_shards:
|
42
43
|
<shard_name>:
|
43
44
|
host: <hostname>
|
@@ -48,6 +49,9 @@ conventions:
|
|
48
49
|
port: <pg_port>
|
49
50
|
```
|
50
51
|
|
52
|
+
In schema names, `%e` is replaced with the current environment, and `%s` is
|
53
|
+
replaced by the shard number.
|
54
|
+
|
51
55
|
Tables can coexist in schemas, though they do not have to.
|
52
56
|
|
53
57
|
In your project, configure `sequel-schema-sharding` in a ruby file that
|
@@ -140,6 +144,14 @@ Never try to insert records with nil values in sharded columns.
|
|
140
144
|
|
141
145
|
TODO: explain why we define `this`
|
142
146
|
|
147
|
+
## Running tests
|
148
|
+
|
149
|
+
```bash
|
150
|
+
> bundle install
|
151
|
+
> bundle exec rake sequel:db:create
|
152
|
+
> bundle exec rspec
|
153
|
+
```
|
154
|
+
|
143
155
|
## FAQ
|
144
156
|
|
145
157
|
### How should I shard my databases?
|
@@ -12,7 +12,8 @@ module Sequel
|
|
12
12
|
# Need to create connection manually with specifying a database in order to create the database
|
13
13
|
connection = Sequel.postgres(:user => config['username'],
|
14
14
|
:password => config['password'],
|
15
|
-
:host => config['host']
|
15
|
+
:host => config['host'],
|
16
|
+
:port => (config['port'] || 5432))
|
16
17
|
|
17
18
|
Sequel::SchemaSharding.logger.info "Creating #{config['database']}.."
|
18
19
|
|
@@ -36,7 +37,8 @@ module Sequel
|
|
36
37
|
begin
|
37
38
|
connection = Sequel.postgres(:user => config['username'],
|
38
39
|
:password => config['password'],
|
39
|
-
:host => config['host']
|
40
|
+
:host => config['host'],
|
41
|
+
:port => (config['port'] || 5432))
|
40
42
|
|
41
43
|
Sequel::SchemaSharding.logger.info "Dropping #{config['database']}.."
|
42
44
|
connection.run("DROP DATABASE #{config['database']}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel-schema-sharding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Henry
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-09-
|
13
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sequel
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.0.
|
134
|
+
rubygems_version: 2.0.3
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Create horizontally sharded Sequel models with Postgres
|