Skip to content

Postgres DB migration tool, written in rust 🦀

Notifications You must be signed in to change notification settings

saiumesh535/db-migration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

db-migration

Postgres DB migration tool, written in rust 🦀

Download source from here

This tool follows specific file structure for sql files as follows

project
│   README.md
└───migrations
│   │   1_some.up.sql
|   |   1_some.down.sql
│   │   2_second.up.sql
|   |   2_second.down.sql
│   │
└───folder2
    │   file021.txt
    │   file022.txt

more info on structure

{number_filename.{type(up|down)}.sql}
1_init.up.sql
1_init.down.sql

you can refer this folder

commands

First you need to have migrations table in database, query can be found here

Commands to run

with migration_type

migration_type=down ./target/release/db_migraiton.exe

with database URL

optionally it uses DB_URL as

postgresql://postgres:postgres@localhost/migration-test

you can override by writing following command

migration_type=down DB_URL=postgresql://postgres:postgres@localhost/migration-test ./target/release/db_migraiton.exe

migration_path

optionally it uses migration_path as follows

migration_path=src/migrations

you can also override migration_path folder path as follows

migration_type=down migration_path=src/scripts/migration_path ./target/release/db_migraiton.exe

schema

you can provide schema for migration table, buy default it uses public schema.

migration_type=up schema=public cargo run

About

Postgres DB migration tool, written in rust 🦀

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages