From 2aee702fc6ff9f3e791268fd87f4e4133594a359 Mon Sep 17 00:00:00 2001 From: genofire Date: Mon, 6 Jun 2022 01:56:24 +0200 Subject: [PATCH] database: migration in transaction --- database/migration.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/database/migration.go b/database/migration.go index 1726433..212556d 100644 --- a/database/migration.go +++ b/database/migration.go @@ -28,7 +28,13 @@ func (config *Database) setupMigrator(testdata bool) (*gormigrate.Gormigrate, er return nil, ErrNothingToMigrate } - return gormigrate.New(config.DB, gormigrate.DefaultOptions, migrations), nil + return gormigrate.New(config.DB, &gormigrate.Options{ + TableName: "migrations", + IDColumnName: "id", + IDColumnSize: 255, + UseTransaction: true, + ValidateUnknownMigrations: false, + }, migrations), nil }