Skip to content

fix: Keep reading statistics when migrating to another source - #138

Open
PoonHarpoon wants to merge 1 commit into
AppFuton:develfrom
PoonHarpoon:fix/migrate-keeps-stats
Open

PoonHarpoon wants to merge 1 commit into
AppFuton:develfrom
PoonHarpoon:fix/migrate-keeps-stats

Conversation

@PoonHarpoon

Copy link
Copy Markdown
Collaborator

Fixes #127

Important because this could be worse with #137

Migrating a title moved its favorites, history and tracking to the new manga id, but not its reading stats. The stats rows stayed on the old id, so the migrated title showed no reading time, and the rows were deleted for good once the old history was purged.

StatsDao.move() now reassigns them, inside the same transaction as the history move. It uses UPDATE OR IGNORE, so if the new title already has a session with the same start time, that row stays on the old id instead of making the migration fail.

#137 adds single and batch source replacement on top of MigrateUseCase, so without this a batch migration would reset stats for many titles at once.

Tests pass but I have not tested on device yet.

Migration moved favourites, history and tracking to the new manga id
but left the stats rows on the old one, so the migrated title showed
no reading time and the rows were lost once the old history was
purged. Move them along with the history.

Fixes AppFuton#127
@github-project-automation github-project-automation Bot moved this to Backlog in Futon project Nov 4, 2026
@PoonHarpoon PoonHarpoon changed the title Keep reading statistics when migrating to another source fix: Keep reading statistics when migrating to another source Nov 4, 2026
@PoonHarpoon

Copy link
Copy Markdown
Collaborator Author

Confirmed working

@PoonHarpoon
PoonHarpoon marked this pull request as ready for review November 5, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

migrating to alternative source resets statistics

1 participant