gomigrator

gomigrator is a simple tools database migration for developer

Installation

  • local install
sudo curl -L "https://github.com/danangkonang/gomigrator/releases/download/0.0.9/gomigrator" -o gomigrator && sudo chmod +x gomigrator
  • global install
sudo curl -L "https://github.com/danangkonang/gomigrator/releases/download/0.0.9/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
  • Test installation.
gomigrator --version

Databases

  • PostgreSQL
  • Mysql

Usage

  • Migration
  # create migration
  gomigrator create migration --table [table name]

  # up migration
  gomigrator up migration

  # down migration
  gomigrator down migration
  • Seeder
  # 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

GitHub

https://github.com/danangkonang/gomigrator