Skip to content

Commit 49ca01e

Browse files
author
Diocrafts
committed
fix(schema): add DROP TRIGGER IF EXISTS before CREATE TRIGGER trg_sync_media_sort_date
The CREATE TRIGGER statement is not idempotent — it fails on restart when the trigger already exists. Add the same DROP/CREATE guard used by trg_files_decrement_blob_ref.
1 parent 2bc77a0 commit 49ca01e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

db/schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ BEGIN
688688
END;
689689
$$ LANGUAGE plpgsql;
690690

691+
DROP TRIGGER IF EXISTS trg_sync_media_sort_date ON storage.file_metadata;
691692
CREATE TRIGGER trg_sync_media_sort_date
692693
AFTER INSERT OR UPDATE OF captured_at ON storage.file_metadata
693694
FOR EACH ROW EXECUTE FUNCTION storage.sync_media_sort_date();

0 commit comments

Comments
 (0)