weixin_39890652 2020-11-20 22:03
浏览 0

autogenerate wants to add existing named index

Migrated issue, originally created by dan milon ()

I've got the following index

Index(EMAIL_UNIQUE_CONSTRAINT_NAME, func.lower(email), unique=True)

and even though it already exists in the database, a new revision tries to create it again.

op.create_index('user_email_unique', 'user', [sa.text('lower("user".email)')], unique=True)

I think autogenerate is able to catch these kind of indexes. Am I doing something wrong?

该提问来源于开源项目:sqlalchemy/alembic

  • 写回答

9条回答 默认 最新

  • weixin_39890652 2020-11-20 22:03
    关注

    Michael Bayer () wrote:

    can you please share:

    1. the target database in use (mysql, Postgresql, etc.)

    2. ensure you're on the latest alembic

    3. have you tried the latest master of alembic? there's a MySQL-related fix to unique indexes that is yet unreleased.

    评论

报告相同问题?