db: initialize bigint, boolean columns
gorp hates nil.
This commit is contained in:
parent
6798adc607
commit
4ce5a36d08
4 changed files with 12 additions and 6 deletions
|
@ -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;
|
||||||
|
|
|
@ -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
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue