/db-docker

Do you need to develop against multiple database providers with sample databases..?

Primary LanguageTSQLMIT LicenseMIT

db-duck

For development against multiple databases and database versions. Run, manage, and orchestrate everything with docker.

Personal Motivation

I work on the open source project SwitchQL and we need to develop and test against multiple database providers and versions. This project makes it easier to work on SwitchQL.

Setup

  1. Install node & npm & Docker
  2. Run npm install

Start

  1. Run npm start to deploy Docker containers.

Stop

  1. Run npm stop to stop them.

Connect to databases

  • MySQL - npm run connect:mysql
  • Postgres - npm run connect:postgres
  • MsSQL - npm run connect:mssql

Database Init

MySql

The two scripts createTables.sql and insertData.sql are placed into the docker-entrypoint-initdb.d directory, which runs the scripts on startup.

Postrgres

The two scripts createTables.sql and insertData.sql are placed into the docker-entrypoint-initdb.d directory, which runs the scripts on startup.

MsSql

The two scripts createTables.sql and insertData.sql are placed into the docker-entrypoint-initdb.d directory, which does not exist natively. The CLI tool sqlcmd is used to run the scripts 10 seconds after the container starts up throught the npm script poststart.