0.0.8 • Published 2 years ago

@hassanzhd/replica-db v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

replicaDB

npm version

What is replicaDB?

replicaDB is a tool that allows you to replicate databases without:

  1. 📝  Writing any SQL.
  2. Ɩ  Worrying about type mapping.
  3. 📖  Creating any database dumps or archives
  4. 💻  Interacting with any sort of UI.

What is required?

All you need is a config.yaml file and replicaDB installed as an npm package.

Features:

  1. replicaDB provides multi engine support that replicates databases even with engine differences 😱

    Following mappings are currently supported:

    SourceDestination
    mysqlmysql
    postgrespostgres
    mysqlpostgres
    postgresmysql
  2. Replicas are created on destination with:

    1. Same table names
    2. Same table schemas
    3. Records part of table

Supported types:

mysql->postgres, postgres->mysql mapping:

Sno.mysql typepostgres type
1smallintsmallint
2bigintbigint
3texttext
4varcharvarchar
5numericnumeric
6charchar
7booleantinyint(1)
8timestamp without time zonedatetime
9timestamp with time zonetimestamp
10time without time zonetime

postgres->mysql mapping:

Sno.postgres typemysql type
1integerint
2uuidvarchar(36)
2bigserialbigint

Config file schema:

source:
  engine: mysql
  host: HOST
  database: DATABASE_NAME
  port: PORT_NUMBER
  user: USER
  password: PASSWORD
destination:
  engine: postgres
  host: HOST
  database: DATABASE_NAME
  port: PORT_NUMBER
  user: USER
  password: PASSWORD

note: engine key can only contain mysql or postgres

Installation:

You can install the package by the following command:

npm i @hassanzhd/replica-db

Usage:

npx replica-db -f <PATH_TO_CONFIG.YAML>

Limitations:

Currently replicaDB works with the following known limitations:

  1. Postgres tables part of "public" schema can only be replicated
  2. Constraints supported include:
    1. PRIMARY KEY
  3. Only tables are replicated, this doesn't include views, stored procedures, etc.

Queries / Feedback:

For any queries, request or feedback please feel free to create an issue

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago