Revert "fix(bookmarks): upsert on title conflict so position upgrades don't 500"

This reverts commit 27b3dcb69f.
This commit is contained in:
2026-08-30 21:01:59 -04:00
parent 27b3dcb69f
commit b1eda696f1
5 changed files with 6 additions and 50 deletions
+1 -21
View File
@@ -893,10 +893,6 @@ ORDER BY deleted ASC, deleted_at DESC NULLS LAST
LIMIT 1;
-- name: CreateMediaBookmarkFull :one
-- The dedup key can change while the title stays the same (e.g. a client
-- upgrading a bookmark from percentage-only to a CFI position), so the
-- title UNIQUE constraint races the dedup-key lookup. Upsert on the title
-- slot: the conflicting row is by definition the same bookmark.
INSERT INTO media_bookmarks (
media_item_id, user_id, page_number, chapter_number,
cfi_position, title, position, notes,
@@ -905,23 +901,7 @@ INSERT INTO media_bookmarks (
device_sync_data
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15
) ON CONFLICT (media_item_id, user_id, title) DO UPDATE SET
page_number = EXCLUDED.page_number,
chapter_number = EXCLUDED.chapter_number,
cfi_position = EXCLUDED.cfi_position,
position = EXCLUDED.position,
notes = EXCLUDED.notes,
percentage_location = EXCLUDED.percentage_location,
epubcfi_location = EXCLUDED.epubcfi_location,
chapter_reference = EXCLUDED.chapter_reference,
dedup_key = EXCLUDED.dedup_key,
last_modified_at = EXCLUDED.last_modified_at,
last_modified_source = EXCLUDED.last_modified_source,
device_sync_data = EXCLUDED.device_sync_data,
created_at = created_at,
deleted = FALSE,
deleted_at = NULL
RETURNING *;
) RETURNING *;
-- name: UpdateMediaBookmarkForSync :one
UPDATE media_bookmarks SET