fix(migrations): stop 7bf4eac76958 renaming link constraints to a sha…#988
Open
manshusainishab wants to merge 2 commits into
Open
fix(migrations): stop 7bf4eac76958 renaming link constraints to a sha…#988manshusainishab wants to merge 2 commits into
manshusainishab wants to merge 2 commits into
Conversation
manshusainishab
requested review from
Pa04rth,
northdpole,
paoga87 and
robvanderveer
as code owners
July 20, 2026 10:36
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughChangesMigration constraint changes
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Author
|
@northdpole here is the PR with the fix as discussed I need a review and merge so I can take a fresh pull to continue with my next PR. |
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
A from-scratch
flask db upgradeon PostgreSQL fails:Migration
7bf4eac76958renames the unique constraints on bothcre_links(
uq_cre_link_pair) andcre_node_links(uq_cre_node_link_pair) to the samename
uq_pair. On Postgres a UNIQUE constraint creates a schema-global index,so the second
uq_paircollides with the first — breaking any from-emptymigration on Postgres. (It slips by on SQLite, where
batch_alter_tablerebuilds the table.)
Fix
Remove those two renames from
7bf4eac76958(upgrade + downgrade). The precedingmigration
0d267ae11945already creates the table-specific constraints, and theSQLAlchemy models keep those names (
uq_cre_link_pair/uq_cre_node_link_pair),so we preserve them instead of collapsing both to
uq_pair. The migration'sactual purpose (adding
node.section_idand updatinguq_node) is unchanged.Validation
Full
flask db upgradefrom an empty PostgreSQL database now completes the entirechain to head
c7d8e9f0a1b2.Note: completing the run also requires
CRE_EMBED_EXPECTED_DIMto be set for thepgvector migration (
c7d8e9f0a1b2) on an empty DB — a separate, pre-existingrequirement of that migration, unrelated to this fix.