I need to configure my app to use multiple shards, and even multiple db adapters. I have noticed that all rake commands like rake db:migrate
are working, and have consequence on shards defined in shards.yml, except rake db:create
.
It will be a real pain to create all this manually.
How can I make it work?
My database.yml (I have defined here, only my master shard)
development:
adapter: postgresql
host: localhost
encoding: unicode
database: db_workload_master_development
pool: 5
username:
password:
production:
......
My shards.yml
octopus:
environments:
- production
- development
development:
shards:
mysql:
host: localhost
adapter: mysql2
database: db_workload_mysql_shard_development
sqlite:
host: localhost
adapter: sqlite3
database: db_workload_sqlite_shard_development
pg:
host: localhost
adapter: postgresql
database: db_workload_pg_shard_development
pool: 5
username:
password:
production:
....
Only db's from database.yml are created with rake-task rake db:create
.
I would recommend creating your own rake task that will read the shards.yml and create the db's as appropriate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With