VOIP-1283-Fix-seed-migration-bind-parameter - #1155
Merged
Merged
Conversation
- bin-dbscheme-manager: Use JSON_OBJECT() instead of raw JSON string literals in the schedule seed migration; sqlalchemy.text() treats ':28' in '{"days":28}' as a bind parameter, failing alembic upgrade
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.
Fix the schedule seed migration failing at alembic upgrade with 'A value is required for bind parameter 28'. alembic op.execute() routes raw SQL through sqlalchemy.text(), which treats the bare colon in the JSON string literal '{"days":28}' as a bind-parameter marker. Replaced the JSON string literals with MySQL JSON_OBJECT() calls, which produce identical JSON values with no colon in the SQL text. Verified: all four op.execute statements in the revision now compile with zero bind parameters; the two create-table revisions contain no bare colons. The tables were created successfully before the seed failed, so recovery is simply re-running alembic upgrade head after this lands (the failed INSERT died at compile time, nothing was partially inserted).