Raise when DB schema version comment is missing#379
Merged
Conversation
…r message Given it has all the detail
oeoeaio
reviewed
Aug 26, 2022
maddymarkovitz
approved these changes
Aug 28, 2022
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.
Resolves #377.
PostgreSQL comment docs
This wasn't as simple as I first thought it'd be, since we also have to cater for the scenario of migrating from before DB schema version was recorded. To detect that case, I'm checking the default for theprioritycolumn, since that was changed to a much more sensible value in migration 2.I did some code archaeology, and determined that, prior to migration 2, the default for theprioritycolumn was 1 since 1050850#diff-f5ed5e5d3159a4a7d9d7ea114936cb2147d07e27ce81dcce79c2814e299d2456R8, which (according to the tags that commit appears in) covers way back to v0.1.0. So this is a safe proxy to detect DB schemas pre version 2. However, theque_jobstable schema at the linked commit differs from the current migration 1 - to consider it as schema version 1 and migrate up would produce an incorrect result, if it even works. But regardless, this check against theprioritycolumn's default preserves the DB schema version 1 detection result as it was before.Migrating when the DB schema version comment is missing now looks like: