immich/mobile/lib
Santo Shakil f632d320f5
fix(mobile): clear linkedRemoteAlbumId in reset() so FK refs dont dangle (#28382)
* fix(mobile): clear linkedRemoteAlbumId in reset() so FK refs dont dangle

reset() runs with foreign_keys off before wiping remote_* tables, so the ON DELETE SET NULL cascade on linkedRemoteAlbumId doesnt fire. local rows keep pointing at deleted remote ids.

affects logout (clearLocalData calls reset()) and the server SyncResetV1 path (30 day idle, etc). after re-login, syncLinkedAlbum either silently warns or fires 400s (those are covered by #28299).

null the column manually inside the same transaction. cascade still works for normal SyncAlbumDeleteV1.

verified on pixel 9a with this branch built locally: logged out, deleted album from web, logged back in. without fix linkedRemoteAlbumId stayed dangling. with fix all three local rows have linkedRemoteAlbumId = NULL after the logout reset, and recovery is clean once manageLinkedAlbums runs again.

* fix(mobile): always re-enable foreign_keys in reset() + simplify the update

re-enable foreign_keys inside a try/finally so it always runs even if the transaction throws. without this, a failed reset would leave the connection with foreign_keys = OFF and silently disable cascades for everything after (per copilot review).

also drop the where filter on the linkedRemoteAlbumId update, unconditional update-all is simpler and we wipe everything in reset anyway (per ganka review).
2026-05-12 13:43:15 -05:00
..
constants refactor: move theme config to metadata table (#28224) 2026-05-07 15:12:14 +00:00
domain fix: limit android background worker duration (#23566) 2026-05-11 23:08:17 -05:00
entities refactor: yeet old timeline (#27666) 2026-04-15 23:00:27 +05:30
extensions feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
infrastructure fix(mobile): clear linkedRemoteAlbumId in reset() so FK refs dont dangle (#28382) 2026-05-12 13:43:15 -05:00
interfaces refactor(mobile): interfaces refactor (#19415) 2025-06-23 11:27:44 -05:00
mixins
models chore: add always_put_control_body_on_new_line lint (#28352) 2026-05-11 13:47:24 -04:00
pages chore: add always_put_control_body_on_new_line lint (#28352) 2026-05-11 13:47:24 -04:00
platform fix: limit android background worker duration (#23566) 2026-05-11 23:08:17 -05:00
presentation fix: kekab icon colors in light mode (#28366) 2026-05-12 11:27:55 -05:00
providers refactor: move map config to metadata table (#28226) 2026-05-11 22:43:52 -05:00
repositories chore: add always_put_control_body_on_new_line lint (#28352) 2026-05-11 13:47:24 -04:00
routing feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
services fix: deep link for assets when asset viewer already open (#27971) 2026-05-12 16:19:54 +00:00
theme fix(mobile): mismatch between system and app color when using low-chroma system color scheme (#27282) 2026-03-27 09:21:43 -05:00
utils fix: kekab icon colors in light mode (#28366) 2026-05-12 11:27:55 -05:00
widgets chore: add always_put_control_body_on_new_line lint (#28352) 2026-05-11 13:47:24 -04:00
main.dart fix: deep link for assets when asset viewer already open (#27971) 2026-05-12 16:19:54 +00:00
wm_executor.dart chore: add always_put_control_body_on_new_line lint (#28352) 2026-05-11 13:47:24 -04:00