multiverse 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +24 -2
- data/lib/generators/multiverse/db_generator.rb +1 -1
- data/lib/multiverse/version.rb +1 -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: 1a5b405124244211b42303192e0aeb223e64fe6f
|
4
|
+
data.tar.gz: dae706b36d5e653b9b3b3b150cbe715cb344ff55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3043d8c0e5f12c3a8ef352b57dc46ba3bd686c3a5f4286957456c28005c07bd6d55827cb3c8010791740548f96971f5e6e069617ab36b9e5412ee8dadea61800
|
7
|
+
data.tar.gz: b8331d53ad7688b15a834d50a5fd0fcb7df408f4455f4386e5e2f549365cb0ab26d72ada5178bb2797392fe5a8c11b4a53dd6d7da707c06349c888ba053c63ac
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -18,13 +18,15 @@ gem 'multiverse'
|
|
18
18
|
|
19
19
|
## Getting Started
|
20
20
|
|
21
|
-
|
21
|
+
In this example, we’ll have a separate database for our e-commerce catalog that we’ll call `catalog`.
|
22
|
+
|
23
|
+
The first step is to generate the necessary files.
|
22
24
|
|
23
25
|
```sh
|
24
26
|
rails generate multiverse:db catalog
|
25
27
|
```
|
26
28
|
|
27
|
-
This
|
29
|
+
This creates a `CatalogRecord` class for models to inherit from and adds configuration to `config/database.yml`. It also creates a `db/catalog` directory for migrations and `schema.rb` to live.
|
28
30
|
|
29
31
|
`rails` and `rake` commands run for the original database by default. To run commands for the new database, use the `DB` environment variable. For instance:
|
30
32
|
|
@@ -93,6 +95,26 @@ And inside the `after_fork` block
|
|
93
95
|
CatalogRecord.establish_connection :"catalog_#{Rails.env}"
|
94
96
|
```
|
95
97
|
|
98
|
+
## Testing
|
99
|
+
|
100
|
+
### Fixtures
|
101
|
+
|
102
|
+
[Rails fixtures](http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures) work automatically.
|
103
|
+
|
104
|
+
### Database Cleaner
|
105
|
+
|
106
|
+
Database Cleaner supports multiple connections out of the box.
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
cleaner = DatabaseCleaner[:active_record, {model: CatalogRecord}]
|
110
|
+
cleaner.strategy = :transaction
|
111
|
+
cleaner.cleaning do
|
112
|
+
# code
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
[Read more here](https://github.com/DatabaseCleaner/database_cleaner#how-to-use-with-multiple-orms)
|
117
|
+
|
96
118
|
## History
|
97
119
|
|
98
120
|
View the [changelog](https://github.com/ankane/multiverse/blob/master/CHANGELOG.md)
|
@@ -19,7 +19,7 @@ module Multiverse
|
|
19
19
|
production_conf = "database: db/#{lower_name}_production.sqlite3"
|
20
20
|
else
|
21
21
|
development_conf = "database: #{lower_name}_development"
|
22
|
-
test_conf = "database: #{lower_name}
|
22
|
+
test_conf = "database: #{lower_name}_test"
|
23
23
|
production_conf = "url: <%= ENV['#{lower_name.upcase}_DATABASE_URL'] %>"
|
24
24
|
end
|
25
25
|
|
data/lib/multiverse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|