Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The SQLite-to-PostgreSQL importer advances only four serial sequences. Imported Plex data can contain much larger IDs in other tables. On our isolated QNAP migration of a real library,
deviceshad 15,192 rows butdevices_id_seqwas still at 1. Plex's startup insert failed with adevices_pkeyduplicate even though all 36 imported tables and 1,152 blobs were otherwise intact.Fix
After the table import, enumerate every owned serial sequence in the target schema and set it to the corresponding table's maximum imported ID. Empty tables leave the next value at 1. A sequence alignment error now fails the migration instead of being silently ignored.
Verification
The same generalized SQL was applied to the isolated migrated PostgreSQL database.
devices_id_seqbecame 15,192, matchingmax(devices.id), and Plex continued serving/identityand all eight library sections. Production Plex remains on SQLite while the canary is evaluated.