Code Monkey home page Code Monkey logo

octopus-sharding-postgresql's Introduction

README

How to Run

  1. go to root directory of project
  2. run docker-compose up --build to build whole system
  3. 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 for transport_dev_new db. refer to same table from transport_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 from transport_dev_new db
  • Re run he migration using rake task specified in step 4
  1. 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

Problems yet to tackle

  1. Creating databases automatically with rake db:setup
  2. Running Schema migration for only one shard initially and then for another shard

octopus-sharding-postgresql's People

Contributors

rajat23 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

raychorn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.