Skip to content

Commit a036167

Browse files
committed
Adjust special cases for sqlite
1 parent 1d8982d commit a036167

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

database/db.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ func (db *DB) BuildInsertIgnoreStmt(into interface{}) (string, int) {
313313
}
314314

315315
clause = fmt.Sprintf("ON CONFLICT ON CONSTRAINT %s DO NOTHING", constraint)
316+
case SQLite:
317+
clause = "ON CONFLICT DO NOTHING"
316318
}
317319

318320
return fmt.Sprintf(
@@ -384,6 +386,9 @@ func (db *DB) BuildUpsertStmt(subject interface{}) (stmt string, placeholders in
384386

385387
clause = fmt.Sprintf("ON CONFLICT ON CONSTRAINT %s DO UPDATE SET", constraint)
386388
setFormat = `"%[1]s" = EXCLUDED."%[1]s"`
389+
case SQLite:
390+
clause = "ON CONFLICT DO UPDATE SET"
391+
setFormat = `"%[1]s" = EXCLUDED."%[1]s"`
387392
}
388393

389394
set := make([]string, 0, len(updateColumns))

0 commit comments

Comments
 (0)