Migrated issue, originally created by Matt Jernigan ()
v0.8.4
autogenerate creates this:
op.create_unique_constraint('form_name', 'forms', ['org_code', 'form_name'])
op.drop_constraint('uq_forms_form_name', 'forms', type_='unique')
instead of this:
op.drop_constraint('uq_forms_form_name', 'forms', type_='unique')
op.create_unique_constraint(op.f('uq_forms_form_name'), 'forms', ['org_code', 'form_name'])
Several problems here:
- Order: drop should be before create.
- Create should maybe use
op.f() - And, most notably,
op.create_unique_constraint('form_name', ...)does not apply naming conventions (it creates a unique constraint calledform_namein this case).
该提问来源于开源项目:sqlalchemy/alembic