Current Postgres schema is in db.
To get the database setup locally (dev or test environment), ensure that Goose is installed locally and then run its setup:
$ go get bitbucket.org/liamstask/goose/cmd/goose
$ DATABASE_URL="postgres://user@localhost/database?sslmode=disable" goose --env development up
To create a Goose migration file, run:
$ goose create AddNewTable sql
$ goose: created db/migrations/20150601093224_AddNewTable.sql
See Goose docs for more info on rolling back migrations.
To run migrations on Heroku, first push them up and then run:
$ heroku run goose --env production up
To update all of the latest dependencies run
$ godep restore
If any dependencies are added, use Godep godep to package them into the repo:
$ godep save
- For updating Goose, be sure to temporarily remove the line
// +build heroku
frominstall_goose.go
so that godep will pick up the package.
The app requires two ENV variables to be set before it'll run:
$ PORT=5000 DATABASE_URL="postgres://user@localhost/database?sslmode=disable" go run main.go