Viorel
Viorel

Reputation: 1468

Alembic drops indexes for foreign keys

I have a column address_id = db.Column(db.Integer, db.ForeignKey(Address.id, ondelete='CASCADE'), index=True). Autogenerating a migration with Alembic always adds a drop_index operation.

op.drop_index('address_id', 'companies')

Why does this happen every time I generate a migration?

Upvotes: 3

Views: 2060

Answers (1)

Miguel Grinberg
Miguel Grinberg

Reputation: 67502

This is a known bug in Alembic 0.6.1. Upgrade to 0.6.2 or newer and the problem will go away.

Upvotes: 4

Related Questions