Skip to content

Commit

Permalink
Fix LastInsertId error in postgres driver, closes #217
Browse files Browse the repository at this point in the history
  • Loading branch information
avakarev committed Mar 18, 2024
1 parent 00412f7 commit 68141c7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gormigrate.go
Expand Up @@ -458,7 +458,8 @@ func (g *Gormigrate) unknownMigrationsHaveHappened() (bool, error) {
}

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

Expand Down

0 comments on commit 68141c7

Please sign in to comment.