autogenerate ignores 'collation' on Varchar/Str/Unicode columns

Issue #475 closed
Rudolph Froger
created an issue

When an explicit collation has been set then autogenerate doesn't use it when generating migrations for new models and/or changed columns.

Comments (1)

  1. Michael Bayer repo owner

    Hi there -

    as is the case for #474 you reported, this is not enough information for me to reproduce. If I try to reproduce taking your sentence as written, I create a model:

    class Foo(Base):
        __tablename__ = 'foo'
        id = Column(Integer, primary_key=True)
        data = Column(String(50, collation='de_DE'))
    

    run autogenerate, and there it is:

    def upgrade():
        # ### commands auto generated by Alembic - please adjust! ###
        op.create_table('foo',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('data', sa.String(length=50, collation='de_DE'), nullable=True),
        sa.PrimaryKeyConstraint('id')
        )
    

    please reopen with specific steps, thanks!

  2. Log in to comment