Categorygithub.com/chouandy/dbmigrater
modulepackage
1.1.0
Repository: https://github.com/chouandy/dbmigrater.git
Documentation: pkg.go.dev

# README

DB Migrater

DB Migrater is a tool for mysql database migrations.

Install

go get -u github.com/chouandy/dbmigrater

DB Config

The db config can be:

  • ENV["DB_DRIVER"]
  • ENV["DB_HOST"]
  • ENV["DB_PORT"]
  • ENV["DB_DATABASE"]
  • ENV["DB_USERNAME"]
  • ENV["DB_PASSWORD"]

Usage

  • Create database
dbmigrater create
  • Drop database
dbmigrater drop
  • Create a set of timestamped up/down migrations
dbmigrater migrate create --name {name}
  • Apply all or N up migrations
dbmigrater migrate up -n {N}
  • Apply 1 or N down migrations
dbmigrater migrate down -n {N}
  • Drop everything inside database
dbmigrater migrate drop

# Functions

CreateDatabase create database.
DropDatabase drop database.
MigrateCreate migrate create.
MigrateDown migrate down.
MigrateDrop migrate drop.
MigrateUp migrate up.

# Structs

CreateCommand the command struct.
DropCommand the command struct.
MigrateCreateCommand the command struct.
MigrateDownCommand the command struct.
MigrateDropCommand the command struct.
MigrateUpCommand the command struct.