Sample project to demonstrate the use of Octopus library for database sharding purpose
docker-compose up --build
to build whole systemdocker exec -it <container_id_of_db> bash
( docker container ls
to see id)config/shards.yml
ar_internal_metadata
for transport_dev_new
db. refer to same table from transport_dev
dbCREATE TABLE ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
ALTER TABLE ONLY ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
INSERT INTO ar_internal_metadata(key, value, created_at, updated_at) values('environment', 'development', NOW(), NOW());
schema_migration_table
from transport_dev_new
dbdocker exec -it <container_id> bash
( docker container ls
to see id)rake db:migrate
rake octopus:copy_schema_versions
rake db:setup