dbmigrate

command module
v0.0.0-...-1b8e333 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2018 License: MIT Imports: 6 Imported by: 0

README

Database migration management for postgres and mysql

go get -u github.com/nirandas/dbmigrate

Initialize

dbmigrate init

Creates a dbmigrate.json file in the current directory. Edit the file and set the dsn. The type can be either postgres or mysql.

Generating migrations

dbmigrate make hello

Generates a timestamped sql file in the migrations path as configured in dbmigrate.json. You can add the SQL statements to be executed during up and down in this file. Separate multiple statements using --go--

--dbmigrate:up
create table users (
id bigint unsigned primary key auto_increment,
username varchar(32) not null unique,
email varchar(100) not null unique,
password varchar(100) not null
)engine=innodb charset=utf8;
--dbmigrate:down
drop table users;

Running migrations

dbmigrate up

dbmigrate down

Use -all switch to up or down all migrations.

dbmigrate up -all

dbmigrate down -all

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL