Skip to content

Commit

Permalink
Make tls_enabled key migratin idempotent.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jan 4, 2022
1 parent 583dab4 commit d8ed404
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/migrations/v2.1.0.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func V2_1_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf) error {
SELECT JSONB_AGG(
JSONB_SET(v - 'tls_enabled', '{tls_type}', (CASE WHEN v->>'tls_enabled' = 'true' THEN '"STARTTLS"' ELSE '"none"' END)::JSONB)
) AS updated FROM settings, JSONB_ARRAY_ELEMENTS(value) v WHERE key = 'smtp'
) s WHERE key = 'smtp';
) s WHERE key = 'smtp' AND value::TEXT LIKE '%tls_enabled%';
`); err != nil {
return err
}
Expand Down

0 comments on commit d8ed404

Please sign in to comment.