Merge pull request #74 from bobbyrullo/db_migrate_redux

db: initialize bigint, boolean columns
This commit is contained in:
bobbyrullo 2015-08-20 16:52:39 -07:00
commit 5f4fa64214
4 changed files with 12 additions and 6 deletions

View file

@ -1,2 +1,4 @@
-- +migrate Up -- +migrate Up
ALTER TABLE client_identity ADD COLUMN "dex_admin" boolean; ALTER TABLE client_identity ADD COLUMN "dex_admin" boolean;
UPDATE "client_identity" SET "dex_admin" = false;

View file

@ -1,2 +1,4 @@
-- +migrate Up -- +migrate Up
ALTER TABLE authd_user ADD COLUMN "created_at" bigint; ALTER TABLE authd_user ADD COLUMN "created_at" bigint;
UPDATE authd_user SET "created_at" = 0;

File diff suppressed because one or more lines are too long

View file

@ -22,6 +22,8 @@ func initDB(dsn string) *gorp.DbMap {
panic(fmt.Sprintf("Unable to drop migration table: %v", err)) panic(fmt.Sprintf("Unable to drop migration table: %v", err))
} }
db.MigrateToLatest(c) if _, err = db.MigrateToLatest(c); err != nil {
panic(fmt.Sprintf("Unable to migrate: %v", err))
}
return c return c
} }