Closed sqlalchemy-bot closed 6 years ago
Connor Wolf (fake-name) wrote:
Arrrgh, I swear I searched drop enum types
before filing this, but now I find https://bitbucket.org/zzzeek/alembic/issues/53/create-table-dont-create-enum AND https://bitbucket.org/zzzeek/alembic/issues/67/autogenerate-with-enums-on-postgres-dont.
It still seems to me that if autogenerate can create enums, it should also destroy them.
Connor Wolf (fake-name) wrote:
Actually, is there a legitimate reason all the type creation/destruction doesn't default to checkfirst=True
?
Michael Bayer (zzzeek) wrote:
the official dupe here is #278. no resources to work on this, sorry. I hope to move the issue tracker to github in the near future to facilitate search.
Michael Bayer (zzzeek) wrote:
In this case, it's just positional (--raiseerr has to be before the command), but that's discordant with most CLI tools.
This is standard Python argparse behavior and is pretty widespread, https://stackoverflow.com/questions/10896211/python-argument-parser-that-handles-global-options-to-sub-commands-properly
Michael Bayer (zzzeek) wrote:
Duplicate of #278.
Michael Bayer (zzzeek) wrote:
Actually, is there a legitimate reason all the type creation/destruction doesn't default to checkfirst=True?
the individual methods do http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#sqlalchemy.dialects.postgresql.ENUM.create
at the metadata level the postgresql.ENUM is trying to be compatible with the generic sqltypes.Enum. The confusion of PG's ENUM type not fitting in with the way database types work throughout the rest of the SQL ecosystem is part of why I'm not in a hurry to try and figure out #278.
Changes by Connor Wolf (fake-name):
Changes by Michael Bayer (zzzeek):
Migrated issue, originally created by Connor Wolf (fake-name)
Basically the title. I have a number of postgresql ENUM types, and they break autogenerated migrations.
The following test-case shows this:
(
settings.py
just contains my db login creds, it's left out for obvious reasons)Generates the following migration:
Trying to migrate ->
head
->base
->head
causes it to fail.Obviously, this is pretty minor, but it can be annoying.
Target DB is PostgreSQL 9.6
As a side note,
--raiseerr
has some issues too:In this case, it's just positional (
--raiseerr
has to be before the command), but that's discordant with most CLI tools.