This refactor is mainly to prevent episodes moving between different series from throwing errors. I changed it so the code tracks when an episode was last updated at the remote (or in the entry stored in the cache), and made it so it conditionally updates the episode record and/or updates the episode title records accordingly.
Also, for the best compatibility with updating existing episode entries did I add a database migration to reset the last updated timestamp on all existing anidb episode records. This won't affect anything other than it will force the episode records to be updated on the first anime refresh/update — be it from the cache or online — after this PR has been merged.
This refactor is mainly to prevent episodes moving between different series from throwing errors. I changed it so the code tracks when an episode was last updated at the remote (or in the entry stored in the cache), and made it so it conditionally updates the episode record and/or updates the episode title records accordingly.
Also, for the best compatibility with updating existing episode entries did I add a database migration to reset the last updated timestamp on all existing anidb episode records. This won't affect anything other than it will force the episode records to be updated on the first anime refresh/update — be it from the cache or online — after this PR has been merged.