TachiWeb / TachiWeb-Server

A port of the Tachiyomi manga reader to the desktop and server
407 stars 46 forks source link

Category ids are not incremented correctly #43

Closed Ligerx closed 5 years ago

Ligerx commented 5 years ago

When you create a category, it creates a new one with id of the largest non-deleted id + 1. However, this is incorrect behavior because it's possible to create a new category with an old id and that old ids' corresponding manga.

example

  1. Create a category
  2. Add manga to that category
  3. Delete that category
  4. Create a new category (name doesn't matter)
  5. Observe that the id is the same as the first category and it 'remembers' your manga in this category

I believe expected behavior is that category ids do not get reset. They continue to increment even if categories are deleted.

null-dev commented 5 years ago

Fixed in https://github.com/TachiWeb/TachiWeb-Server/commit/102ca6230358eb0a505948d15d49765f5c360dc6

The category id increment behavior was actually correct. The category manga being remembered was definitely not intended behavior.

This issue occurred because the cleanup calls were not being run after stuff was deleted in the database. This was a pretty critical issue, and it probably caused a ton of other bugs... Excellent find!