- go to root directory of project
- run
docker-compose up --build
to build whole system - go to another window and connect to db using
docker exec -it <container_id_of_db> bash
(docker container ls
to see id)
- create both databases specified in
config/shards.yml
- run the migration using rake task from web container as specified in step 4
- create table
ar_internal_metadata
fortransport_dev_new
db. refer to same table fromtransport_dev
db
CREATE 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());
- clean all rows from
schema_migration_table
fromtransport_dev_new
db - Re run he migration using rake task specified in step 4
- go to another window and connect to rails app using
docker exec -it <container_id> bash
(docker container ls
to see id)
- run
rake db:migrate
- run
rake octopus:copy_schema_versions
- Creating databases automatically with
rake db:setup
- Running Schema migration for only one shard initially and then for another shard