Skip to content

mrsova/go-migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-migrate

Application for creating postgres migration

Example Usage

Config structure

[migrate]
tablename= "migrations"
dir= "./example/migrations"

[database]
username = "user"
password = "pass"
host = "0.0.0.0"
port = "5432"
database = "database"

Example sql file for migrate

@DOWN - separator between up and down

create table users
(
    id   uuid not null constraint users_id_unique  unique,
    username varchar(255) constraint users_username_unique unique,
);

@DOWN
drop table users;

Run up

  ./vendor/github.com/mrsova/go-migrate/bin/app --config-path=./example/config/config.toml

Run down decrement by one

  ./vendor/github.com/mrsova/go-migrate/bin/app --config-path=./example/config/config.toml --rollback=true

About

Migrations for postgres

Resources

Stars

Watchers

Forks

Packages

No packages published