fix: data conflict handler

This commit is contained in:
Steven
2023-12-10 10:07:26 +08:00
parent d275713aff
commit 0127e08a28
5 changed files with 14 additions and 30 deletions

View File

@ -44,9 +44,10 @@ func (d *DB) UpsertMigrationHistory(ctx context.Context, upsert *store.UpsertMig
qb := squirrel.Insert("migration_history").
Columns("version").
Values(upsert.Version).
Suffix("ON CONFLICT (version) DO UPDATE SET version = ?", upsert.Version)
Suffix("ON CONFLICT (version) DO NOTHING").
PlaceholderFormat(squirrel.Dollar)
query, args, err := qb.PlaceholderFormat(squirrel.Dollar).ToSql()
query, args, err := qb.ToSql()
if err != nil {
return nil, err
}