From 32fe697660173c3891d026adbfc83f95d47f425e Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 19 Jun 2026 20:14:25 -0400 Subject: [PATCH] vector clock --- .../uploaded_video_notes/update_uploaded_video_note.rs | 10 ++++++---- .../queries/uploaded_videos/update_uploaded_video.rs | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/schema/database/mysql_queries/src/queries/uploaded_video_notes/update_uploaded_video_note.rs b/crates/schema/database/mysql_queries/src/queries/uploaded_video_notes/update_uploaded_video_note.rs index 31cfbbdbab..c0ff6edcfe 100644 --- a/crates/schema/database/mysql_queries/src/queries/uploaded_video_notes/update_uploaded_video_note.rs +++ b/crates/schema/database/mysql_queries/src/queries/uploaded_video_notes/update_uploaded_video_note.rs @@ -26,9 +26,10 @@ where pub phantom: PhantomData<&'c E>, } -/// Update the mutable fields of an `uploaded_video_notes` record by `token`. -/// `updated_at` is refreshed via the column's `ON UPDATE` clause. Returns the -/// number of rows affected (0 if no row matched). +/// Update the mutable fields of an `uploaded_video_notes` record by `token`. The +/// `version` vector clock is incremented by 1, and `updated_at` is refreshed via +/// the column's `ON UPDATE` clause. Returns the number of rows affected (0 if no +/// row matched). pub async fn update_uploaded_video_note<'e, 'c: 'e, E>( args: UpdateUploadedVideoNoteArgs<'e, 'c, E>, ) -> Result @@ -45,7 +46,8 @@ SET maybe_website = ?, maybe_other_website = ?, maybe_comments = ?, - maybe_comment_update_ip_address = ? + maybe_comment_update_ip_address = ?, + version = version + 1 WHERE token = ? LIMIT 1 "#, diff --git a/crates/schema/database/mysql_queries/src/queries/uploaded_videos/update_uploaded_video.rs b/crates/schema/database/mysql_queries/src/queries/uploaded_videos/update_uploaded_video.rs index aa0ef1c885..66be037508 100644 --- a/crates/schema/database/mysql_queries/src/queries/uploaded_videos/update_uploaded_video.rs +++ b/crates/schema/database/mysql_queries/src/queries/uploaded_videos/update_uploaded_video.rs @@ -28,9 +28,9 @@ where } /// Update the mutable fields of an `uploaded_videos` record by `token` -/// (dimensions, detection, report, updater IP). `updated_at` is refreshed via -/// the column's `ON UPDATE` clause. Returns the number of rows affected (0 if no -/// row matched). +/// (dimensions, detection, report, updater IP). The `version` vector clock is +/// incremented by 1, and `updated_at` is refreshed via the column's `ON UPDATE` +/// clause. Returns the number of rows affected (0 if no row matched). pub async fn update_uploaded_video<'e, 'c: 'e, E>( args: UpdateUploadedVideoArgs<'e, 'c, E>, ) -> Result @@ -47,7 +47,8 @@ SET maybe_detected_model_family = ?, maybe_detected_model_type = ?, maybe_report = ?, - maybe_updated_ip_address = ? + maybe_updated_ip_address = ?, + version = version + 1 WHERE token = ? LIMIT 1 "#,