immich/mobile/test
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
..
domain fix(mobile): clear linkedRemoteAlbumId in reset() so FK refs dont dangle (#28382) 2026-05-12 13:43:15 -05:00
drift/main fix: indexes on remote_asset_entity (#28264) 2026-05-12 16:43:24 +00:00
fixtures feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
infrastructure feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
medium refactor: medium repository context helpers (#28311) 2026-05-09 08:19:31 -05:00
mocks feat: opt-in sync of deletes and restores from web to Android (beta timeline) (#20473) 2025-11-10 16:20:51 +00:00
modules refactor(mobile): Migrate durationInSeconds to durationMs (#26615) 2026-04-20 23:28:11 -04:00
presentation/widgets fix(mobile): images loads sometimes cancel too early (#27067) 2026-03-27 10:35:50 -04:00
services refactor: app metadata (#28113) 2026-05-05 10:45:51 +07:00
test_utils refactor: yeet old timeline (#27666) 2026-04-15 23:00:27 +05:30
unit refactor: app metadata (#28113) 2026-05-05 10:45:51 +07:00
utils_legacy feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
api.mocks.dart refactor: yeet old timeline (#27666) 2026-04-15 23:00:27 +05:30
mock_http_override.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00
repository.mocks.dart refactor: yeet old timeline (#27666) 2026-04-15 23:00:27 +05:30
service.mocks.dart refactor: yeet old timeline (#27666) 2026-04-15 23:00:27 +05:30
test_utils.dart feat: recently added assets page (#28272) 2026-05-11 21:35:10 +00:00
utils.dart refactor: medium repository context helpers (#28311) 2026-05-09 08:19:31 -05:00
widget_tester_extensions.dart chore: bump dart sdk to 3.8 (#20355) 2025-07-28 14:04:03 -05:00