db: initialize bigint, boolean columns

gorp hates nil.
This commit is contained in:
Bobby Rullo 2015-08-20 12:38:15 -07:00
parent 6798adc607
commit 4ce5a36d08
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
} }