Alembic doesn't detect adding unique constraints #1316
Unanswered
matthiasburger
asked this question in
Usage Questions
Replies: 2 comments 1 reply
-
Hi I think sqlalchemy does not currently reflect any unique constraint in sql server, so that may be the reason for it. moving to discussion |
Beta Was this translation helpful? Give feedback.
0 replies
-
well seems like sometimes it does... when I remove the schema in the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
Alembic doesn't detect adding unique constraints. Hint, I'm not using default schema.
Expected behavior
if I add
unique=True
for single-columns orUniqueConstraint("col1", "col2")
into__table_args__
it should generate the unique constraints into migration-fileTo Reproduce
I'm using tiangolo sqlmodel and in my database-model I wanted to add unique-constraints, so one is kind of a business-key and the other is for mapping tables - both aren't recognized by alembic.
The one for the business-key is in a base-table (because all non-mapping-tables inherit from this class) and looks like this:
so when I now add
unique=True
to the BusinessKeyModel.businessKey and try to generate a new migration with alembic, (with autogenerate) it doesn't detect the changes.Same goes for my mapping-tables, after I added
UniqueConstraint
into my__table_args__
I think it should detect the changes:Versions.
Have a nice day!
Have a nice day too :)
Beta Was this translation helpful? Give feedback.
All reactions