Reuse Postgres custom enum type? #1070
Unanswered
g-bar
asked this question in
Usage Questions
Replies: 1 comment
-
pass create_type=False to the ENUM constructor within your alembic migration scripts, then use the create() method in your alembic migration as needed i.e. |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
So I have 2 models that use the same custom Enum type like so:
After autogenerating the migration script and trying to upgrade the schema I get an error:
It looks like Alembic generated 2 separate
CREATE TYPE
statements with the same name. The easiest work around is to name the second one differently but that would result in 2 equal types in the database. Is there a way to tell alembic to not create a new type but use an existing oneThanks for the input.
Beta Was this translation helpful? Give feedback.
All reactions