Skip to content

Commit

Permalink
Adjust special cases for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
jrauh01 committed Dec 9, 2024
1 parent 8e45b33 commit 548aedd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ func (db *DB) BuildInsertIgnoreStmt(into interface{}) (string, int) {
}

clause = fmt.Sprintf("ON CONFLICT ON CONSTRAINT %s DO NOTHING", constraint)
case SQLite:
clause = "ON CONFLICT DO NOTHING"
}

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

clause = fmt.Sprintf("ON CONFLICT ON CONSTRAINT %s DO UPDATE SET", constraint)
setFormat = `"%[1]s" = EXCLUDED."%[1]s"`
case SQLite:
clause = "ON CONFLICT DO UPDATE SET"
setFormat = `"%[1]s" = EXCLUDED."%[1]s"`
}

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

0 comments on commit 548aedd

Please sign in to comment.