https://github.com/ujinjinjin/dingo
Framework-agnostic and lightweight database migration tool
https://github.com/ujinjinjin/dingo
database-installer migration migration-tool migrations sql sql-migrations
Last synced: about 2 months ago
JSON representation
Framework-agnostic and lightweight database migration tool
- Host: GitHub
- URL: https://github.com/ujinjinjin/dingo
- Owner: Ujinjinjin
- License: mit
- Created: 2020-01-04T21:19:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-22T01:03:21.000Z (over 1 year ago)
- Last Synced: 2025-12-15T19:56:11.939Z (3 months ago)
- Topics: database-installer, migration, migration-tool, migrations, sql, sql-migrations
- Language: C#
- Homepage:
- Size: 520 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dingo
`dingo` is a framework-agnostic lightweight cross-platform database migration tool that will keep your database schema in sync across multiple developers and deployment environments.
It's a command line tool that can be used on any project regardless of the programming language used to create it, be it Python, Go, C#, Java, Ruby, PHP or something else. This tool fits especially well with microservice architecture and services written in different languages, allowing you to have consistent and unified database migration process.
## Key features
- Supports Postgres and SQL Server
- Migrations are timestamp-versioned
- Migrations are written using plain `.sql`
- Project configs can be stored as `.yml`, `.json` or environment variables
- Use different configuration profiles for different environments
- Provides tools for rapid database development
- Apply and revert database migrations
## Summary
| | |
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Build Status | [](https://dev.azure.com/ujinjinjin/Dingo/_build/latest?definitionId=15&branchName=master) |
| Unit Tests | [](https://dev.azure.com/ujinjinjin/Dingo/_build/latest?definitionId=12&branchName=master) |
| Test Coverage |  |
| Version |  |
| Downloads |  |
| License | [](https://github.com/Ujinjinjin/dingo/blob/master/LICENSE) |
| Docs | [](https://ujinjinjin.github.io/dingo/dingo.html) |
## Installation
### Linux
To install `dingo` on Linux run following commands:
```shell
curl -s https://api.github.com/repos/ujinjinjin/dingo/releases/latest \
| grep "browser_download_url.*x64.deb" \
| cut -d '"' -f 4 \
| wget -O dingo.deb -qi -
sudo dpkg --install dingo.deb
```
> If you want to install `dingo` on a `arm64` system, replace `x64` with `arm64` in the `grep` command
Then add `/usr/share/dingo` to the `$PATH` environment variable. Run following command to validate successful installation:
```shell
dingo --version
```
To uninstall `dingo` use:
```shell
sudo dpkg --remove dingo
```
### macOS
To install `dingo` on macOS run following commands:
```shell
curl -s https://api.github.com/repos/ujinjinjin/dingo/releases/latest \
| grep "browser_download_url.*x64.pkg" \
| cut -d '"' -f 4 \
| xargs -I packageUrl curl packageUrl -L -s -o dingo.pkg
installer -pkg dingo.pkg -target CurrentUserHomeDirectory
```
> If you want to install `dingo` on a `arm64` system, replace `x64` with `arm64` in the `grep` command
## Getting started
Let's apply our first migrations on a PostgreSQL database. Firstly, create project folder:
```shell
mkdir user-service
cd user-service
```
Then initialize `dingo` configuration profile using command below:
```shell
dingo init
```
The command above will create `user-service/.dingo/config.yml` file. Open it and add content from the snippet below and replace `HOST`, `DB_NAME`, `USERNAME` and `PWD` with relevant values:
```yaml
db:
connection-string: Server=HOST;Database=DB_NAME;User Id=USERNAME;Password=PWD;
provider: PostgreSQL
```
Now let's create our first migration at `user-service/migrations/tables/users`:
```shell
dingo new -n create_table -p user-service/migrations/tables/users
```
The command will create a file `user-service/migrations/tables/users/YYYYMMDDmmHHss_create_table.sql`, where `YYYYMMDDmmHHss` is a timestamp. Let's open it and fill out with migration logic:
```postgresql
-- up
create table "user" (
user_id serial not null,
username text not null
);
-- down
drop table "user";
```
Now let's apply migration using following command:
```shell
dingo up -p user-service/migrations
```
Done! You can check your DB, migration is applied and everything should be up-to-date.
If you wish to rollback last applied patch (execute down part of migrations), you can do that using:
```shell
dingo down -p user-service/migrations
```
For additional information on usage refer to [wiki](https://ujinjinjin.github.io/dingo/dingo.html) or run:
```shell
dingo --help
```