gomigrator
gomigrator
is a simple tools database migration for developer
Installation
sudo curl -L "https://github.com/danangkonang/gomigrator/releases/download/0.1.3/gomigrator" -o gomigrator && sudo chmod +x gomigrator
sudo curl -L "https://github.com/danangkonang/gomigrator/releases/download/0.1.3/gomigrator" -o /usr/local/bin/gomigrator
- Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/gomigrator
- If the command gomigrator fails you cant run this
sudo ln -s /usr/local/bin/gomigrator /usr/bin/gomigrator
gomigrator --version
Databases Support
Usage
Usage: gomigator [COMAND] [OPTIONS]
Commands:
init Generate default directory to manage migration
create Creates new migration or seeder file
up Migrate to database
down Roll back migration
migration Generate migration type
seeder Generate seeder type
Options:
-h, --help Print help gomigrator
-v, --version Print version gomigrator
--table Table name
--tables List table
--name Generate file name
gomigrator init
Default init will generate driver postgres, you can custom driver with gomigrator init --driver [mysql/psql]
or other flags gomigrator init --help
.
gomigrator saved connection file db/mogration/0.go
# create migration
gomigrator create migration --table [table name]
# up migration
gomigrator up migration
# down migration
gomigrator down migration
# create seeder file
gomigrator create seeder --table [table name]
# up seeder
gomigrator up seeder
# down seeder
gomigrator down seeder
See example seeder with fake data