Skip to content

Commit

Permalink
fix: Fix insert migration method to use a structure instead of a map
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyno-zeta committed Mar 18, 2024
1 parent 56c66f9 commit 5641a74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gormigrate.go
Expand Up @@ -458,7 +458,9 @@ func (g *Gormigrate) unknownMigrationsHaveHappened() (bool, error) {
}

func (g *Gormigrate) insertMigration(id string) error {
record := map[string]interface{}{g.options.IDColumnName: id}
record := g.model()
v := reflect.ValueOf(record)
v.Elem().FieldByName("ID").SetString(id)
return g.tx.Table(g.options.TableName).Create(record).Error
}

Expand Down

0 comments on commit 5641a74

Please sign in to comment.