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
- Install node & npm & Docker
- Run
npm install
Start
- Run
npm start
to deploy Docker containers.
Stop
- 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
.