Skip to content

Commit 0883909

Browse files
authored
Merge pull request #3 from CloudInn/transactional-migrations
use transaction in migrations by default
2 parents 0652f11 + ff0a35a commit 0883909

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

migo.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
type Migrations []*gormigrate.Migration
1515

1616
type gormGooseData struct {
17-
lastAppliedMigrationID string
17+
lastAppliedMigrationID string
1818
}
1919

2020
type gormMigration struct {
@@ -25,7 +25,13 @@ type gormMigration struct {
2525
}
2626

2727
var DefaultOptions *Options = &Options{
28-
Options: *gormigrate.DefaultOptions,
28+
Options: gormigrate.Options{
29+
TableName: gormigrate.DefaultOptions.TableName,
30+
IDColumnName: gormigrate.DefaultOptions.IDColumnName,
31+
IDColumnSize: gormigrate.DefaultOptions.IDColumnSize,
32+
UseTransaction: true,
33+
ValidateUnknownMigrations: gormigrate.DefaultOptions.ValidateUnknownMigrations,
34+
},
2935
}
3036

3137
type Options struct {
@@ -132,4 +138,4 @@ func getLastGormGooseAppliedMigration() (string, error) {
132138
return "", result.Error
133139
}
134140
return fmt.Sprint(gm.VersionID), result.Error
135-
}
141+
}

0 commit comments

Comments
 (0)