Is it possible to conditionally check for constraints on migrations? #1718
Unanswered
jvanasco
asked this question in
Usage Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm dealing with a database that has become quite messy due to a mix of User Error (I admit this) and sqlite3 being weird.
Then general situation is this:
UniqueConstraint(cols)
whenIndex(cols, unique=True
) should have been used.I've been fixing undeployed migrations to avoid this from happening as the fixups are annoying.
I can't seem to find anything in the docs that would let me check the active schema to act conditionally on whether or not a constraint or index exists in the database. Is this easily possible?
Use case- On downgrades, I don't want to recreate a Unique Constraint when I should have had a Unique Index.
Beta Was this translation helpful? Give feedback.
All reactions