Can Alembic Autogenerate column alterations?

后端 未结 2 2036
谎友^
谎友^ 2021-02-02 08:51

I was able to use alembic --autogenerate for when adding / removing columns.

However, when I wanted to modify for example a \"url\" column from 200 charact

2条回答
  •  无人共我
    2021-02-02 09:16

    Looks like I found the answer on reddit's /r/flask.

    http://www.reddit.com/r/flask/comments/1glejl/alembic_autogenerate_column_changes/cale9o0

    Just add "compare_type=True" to context.configure() parameters inside your env.py's "run_migrations_online" function.

        context.configure(
                    connection=connection,
                    target_metadata=target_metadata,
                    compare_type=True
                    )
    

提交回复
热议问题