Skip to content
!!! Under development !!! scheman is database schema migration tool.
Go
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
scheman-g
scheman-mysql
testdata
.gitignore
README.md
a_first_test.go
config.go
errors.go
scheman.go
scheman_mysql_test.go
scheman_sqlite3_test.go
scheman_test.go
z_last_test.go

README.md

Scheman

Build Status

!!! Under development !!!

scheman is database schema migration tool.

Testing

  • Install scheman. go get github.com/ToQoz/scheman
  • Install dependencies for test. go list -f '{{.TestImports}}' github.com/ToQoz/scheman/... | sed 's/\[//g' | sed 's/\]//g' | xargs go get
  • Run tests. go test github.com/ToQoz/scheman/...

Usage

Generate migration

$ mkdir migrations
$ go get github.com/ToQoz/scheman/scheman-g
$ scheman-g create_posts
create: migrations/20131103115446_create_posts_up.sql
create: migrations/20131103115446_create_posts_down.sql

# if you want to specify migrations directory
$ scheman-g -path ./sql create_posts
create: sql/20131103115446_create_posts_up.sql
create: sql/20131103115446_create_posts_down.sql

Execute migrations

If you use MySQL and want to use frontend that provided by scheman.

$ go get github.com/ToQoz/scheman/scheman-mysql
$ vi scheman.json
$ cat !$
cat scheman.json
{
  "User":           "mysql login user",
  "Password":       "mysql login password",
  "Database":       "mysql database name",
  "Encoding":       "mysql database encoding(default utf8)",
  "MigrationsPath": "migration files directory path",
  "Version":        "migration version"
}
$ scheman-mysql create
$ scheman-mysql migrate

See also scheman-mysql's README

If you use other RDBMS or want to use your own frontend.

$ vi migrate.go # Write with reference to http://github.com/ToQoz/scheman/tree/master/scheman-mysql
$ go run migrate.go
You can’t perform that action at this time.