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

MediaId UUID migration #3597

Merged
merged 3 commits into from
Nov 17, 2024
Merged

Conversation

nichwall
Copy link
Contributor

@nichwall nichwall commented Nov 9, 2024

This PR fixes #2324.

This adds a migration to convert the mediaId column in the libraryItems table to be a UUID instead of a UUIDv4. After performing the migration on my test server, everything still seemed to be linked correctly between mediaProgress, libraryItem, books, and podcasts, where deleting a book did cascade correctly. I was also able to scan my library and saw new rows created correctly in each table.

The only performance difference I saw was in the noise (less than 3 ms difference on any given query).

I am a little hesitant about this change if anything goes wrong during the migration due to SQLite copying the table, creating a new table, then moving data over. From my reading, this can trigger delete cascades, but I did not experience that in my testing. Additional reading at https://sequelize.org/docs/v6/other-topics/query-interface/#changing-and-removing-columns-in-sqlite and https://stackoverflow.com/a/70486686

@advplyr
Copy link
Owner

advplyr commented Nov 17, 2024

There are 5 other models that I added into the migration still using UUIDv4.
I tested this thoroughly and didn't come across any issues.
Updated it for v2.17.0.

Thanks!

@advplyr advplyr merged commit 46a3c3d into advplyr:master Nov 17, 2024
5 checks passed
@nichwall nichwall deleted the mediatype_uuid_migration branch November 17, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Data type mismatch in database
2 participants