Skip to content

Commit 9db33aa

Browse files
feat: add trigger to update timestamp in competition_data on record update
1 parent 003a9ee commit 9db33aa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

database/d1_schema.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,9 @@ AFTER UPDATE ON result_files
205205
BEGIN
206206
UPDATE result_files SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
207207
END;
208+
209+
CREATE TRIGGER IF NOT EXISTS update_competition_data_timestamp
210+
AFTER UPDATE ON competition_data
211+
BEGIN
212+
UPDATE competition_data SET updated_at = CURRENT_TIMESTAMP WHERE competition_id = NEW.competition_id AND year = NEW.year;
213+
END;

0 commit comments

Comments
 (0)