Skip to content

Commit

Permalink
add custom comparison for setting_value in postgres (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesHarness authored and Harness committed Mar 28, 2024
1 parent 6093a4c commit 2eac3c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/store/database/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,12 @@ func (s *SettingsStore) Upsert(ctx context.Context,
UPDATE SET
setting_value = EXCLUDED.setting_value
WHERE
settings.setting_value <> EXCLUDED.setting_value`)
`)
if strings.HasPrefix(s.db.DriverName(), "sqlite") {
stmt = stmt.Suffix(`settings.setting_value <> EXCLUDED.setting_value`)
} else {
stmt = stmt.Suffix(`settings.setting_value::text <> EXCLUDED.setting_value::text`)
}

sql, args, err := stmt.ToSql()
if err != nil {
Expand Down

0 comments on commit 2eac3c3

Please sign in to comment.