more sql consolidation [CI SKIP]

This commit is contained in:
2026-01-14 18:01:57 +11:00
parent 1fca81a7b3
commit 9be3a3d807
2 changed files with 24 additions and 9 deletions

View File

@@ -604,15 +604,7 @@ func ensureSnapshotRowID(ctx context.Context, dbConn *sqlx.DB, tableName string)
return err
}
}
_, err = dbConn.ExecContext(ctx, fmt.Sprintf(
`UPDATE %s SET "RowId" = nextval(pg_get_serial_sequence('%s','RowId')) WHERE "RowId" IS NULL`,
tableName, tableName,
))
if err != nil {
errText := strings.ToLower(err.Error())
if strings.Contains(errText, "pg_get_serial_sequence") || strings.Contains(errText, "sequence") {
return nil
}
if err := db.BackfillSerialColumn(ctx, dbConn, tableName, "RowId"); err != nil {
return err
}
case "sqlite":