Database migrations. CLI and Golang library.
Go to file
Matthias Kadenbach 526c0a918e add packagecloud.io badge 2017-02-09 20:09:11 -08:00
cli move CLI usage in own README 2017-02-09 20:00:38 -08:00
database add comments for source 2017-02-09 19:42:48 -08:00
migrate add code comments for package migrate 2017-02-09 16:59:30 -08:00
source add comments for source 2017-02-09 19:42:48 -08:00
testing add example for parallelTest 2017-02-09 19:52:50 -08:00
.gitignore add .godoc.pid to gitignore 2017-02-09 13:47:28 -08:00
.travis.yml add make release 2017-02-08 19:54:50 -08:00
CONTRIBUTING.md move contributing in own file 2017-02-09 20:03:56 -08:00
LICENSE initial version 3.0.0 preview 2017-02-07 22:01:29 -08:00
Makefile fix line break in makefile 2017-02-09 12:03:03 -08:00
README.md add packagecloud.io badge 2017-02-09 20:09:11 -08:00
log.go add some more comments 2017-02-09 18:23:08 -08:00
migrate.go rename nameFromUrl to schemeFromUrl 2017-02-09 18:19:13 -08:00
migrate_test.go add some more comments 2017-02-09 18:23:08 -08:00
migration.go fix old ref to LogString 2017-02-09 18:26:58 -08:00
migration_test.go rename Migration.LongString to LogString 2017-02-09 18:06:38 -08:00
util.go rename nameFromUrl to schemeFromUrl 2017-02-09 18:19:13 -08:00
util_test.go add test for suint 2017-02-09 18:16:16 -08:00

README.md

migrate

Build Status GoDoc Coverage Status packagecloud.io

Database migrations written in Go. Use as CLI or import as library.

Databases

Database drivers are responsible for applying migrations to databases. Implementing a new database driver is easy. Just implement database/driver interface

Migration Sources

Source Drivers read migrations from various locations. Implementing a new source driver is easy. Just implement the source/driver interface.

CLI usage

CLI Documentation

Example:

go get -u -tags 'postgres' -o migrate github.com/mattes/migrate/cli

migrate -database postgres://localhost:5432/database up 2

Use in your Go project

import (
  "github.com/mattes/migrate/migrate"
  _ "github.com/mattes/migrate/database/postgres"
  _ "github.com/mattes/migrate/source/github"
)

func main() {
  m, err := migrate.New("github://mattes:personal-access-token@mattes/migrate_test",
    "postgres://localhost:5432/database?sslmode=enable")
  m.Steps(2)
}

Migration files

Each migration version has an up and down migration.

1481574547_create_users_table.up.sql
1481574547_create_users_table.down.sql

Development, Testing and Contributing

Guide

Alternatives