Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database migration nukes episode table #2489

Closed
rg9400 opened this issue May 7, 2024 · 4 comments
Closed

Database migration nukes episode table #2489

rg9400 opened this issue May 7, 2024 · 4 comments

Comments

@rg9400
Copy link

rg9400 commented May 7, 2024

Describe the bug
This database migration is bad. It removes the entire episode table, causing Bazarr to have to reindex the full list.

To Reproduce

  1. Get a Bazarr version running with database version 30f37e2e15e1 and episode histories
  2. Update Bazarr to the latest nightly version, so database version 452dd0f0b578 and check the episode table, verify it is all empty

Expected behavior
Database migrations should not nuke the episode table

Software (please complete the following information):

  • Bazarr: [e.g. v 0.6.1] 1.4.3-beta.32
@morpheus65535
Copy link
Owner

In the last migration, we do some cleanup of an old left over column that have been recreated under a new name since then (alternativeTitle from table_shows) and that is causing issue while migrating to postgresql. This removal of column requires, under sqlite, to recreate the table under a temporary name, delete the old table and rename the new to the old name.

Unfortunately, the side effect of the old table deletion is that there's a ForeignKey constraint that cascade this deletion in table_episodes and, consequently, in table_history and table_blacklist.

I'll try to see if I can make alembic disable ForeignKey constraints before trying to migrate schema.

@morpheus65535
Copy link
Owner

Should be fixed in upcoming beta. Can you test and confirm please. I haven't been able to reproduce on my side with this fix. Thanks for reporting BTW!

@rg9400
Copy link
Author

rg9400 commented May 9, 2024

This issue seems resolved with the latest migration fix!

@rg9400 rg9400 closed this as completed May 9, 2024
@morpheus65535
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants