You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When autogenerating the field, alembic outputs a create_table command like the following
# ### commands auto generated by Alembic - please adjust! ###op.create_table('contacts',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('email', postgresql.DOMAIN('email', CITEXT()), nullable=False),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
Notably,
CITEXT is not imported from the postgresql dialect and there a syntax error in the generated migration.
The check constraint is dropped in the generated DOMAIN definition
Fixing these and applying the upgrade creates the correct schema, however every subsequent attempt to autogenerate for the model results in spurious alter_column commands like the following:
No alter_column command is issued if the underlying model has not changed.
To Reproduce
Please try to provide a Minimal, Complete, and Verifiable example, with the migration script and/or the SQLAlchemy tables or models involved.
See also Reporting Bugs on the website.
# Insert code here
Error
# Copy error here. Please include the full stack trace.
Versions.
OS: Ubuntu 22.04.3 LTS
Python: 3.11.2
Alembic: 1.12.0
SQLAlchemy: 2.0.21
Database: 15.4
DBAPI: psycopg[c]==3.1.12
Additional context
Have a nice day!
The text was updated successfully, but these errors were encountered:
this would be two separate bugs. the false positive is more urgent. the render is not as easy to implement and can always be worked around. I suggest splitting into two issues
Definitely agree. If the column changes were only generated when the model changed then it'd be no bother to edit the output manually. I originally wrote it that way, but couldn't really describe the bug without mentioning the templating issues.
Describe the bug
I have the following postgres domain in my model
When autogenerating the field, alembic outputs a
create_table
command like the followingNotably,
CITEXT
is not imported from thepostgresql
dialect and there a syntax error in the generated migration.check
constraint is dropped in the generatedDOMAIN
definitionFixing these and applying the upgrade creates the correct schema, however every subsequent attempt to autogenerate for the model results in spurious
alter_column
commands like the following:In particular,
existing_type
is inferred as the underlying datatype rather than the domainDOMAIN
type suffers from the same issues listed aboveExpected behavior
The type is templated correctly, including the check constraint(see Rendering postgresql dialect DOMAIN field #1360)alter_column
command is issued if the underlying model has not changed.To Reproduce
Please try to provide a Minimal, Complete, and Verifiable example, with the migration script and/or the SQLAlchemy tables or models involved.
See also Reporting Bugs on the website.
# Insert code here
Error
Versions.
Additional context
Have a nice day!
The text was updated successfully, but these errors were encountered: