Skip to content

Commit

Permalink
fix: run migrations in transactions
Browse files Browse the repository at this point in the history
Addresses pathwar#511
  • Loading branch information
moul committed Jun 3, 2020
1 parent 1520f33 commit 3997871
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/pkg/pwdb/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import (
)

func migrate(db *gorm.DB, sfn *snowflake.Node, opts Opts) error {
m := gormigrate.New(db, gormigrate.DefaultOptions, []*gormigrate.Migration{})
migrateOpts := gormigrate.DefaultOptions
migrateOpts.UseTransaction = true
m := gormigrate.New(db, migrateOpts, []*gormigrate.Migration{})

// only called on fresh database
m.InitSchema(func(tx *gorm.DB) error {
Expand Down

0 comments on commit 3997871

Please sign in to comment.