Migrated issue, originally created by Waseem Jan ()
Every time I create a new revision, Alembic tries to remove the already existing foreign keys and then tries to add them again. Logs looks like this
INFO [alembic.autogenerate.compare] Detected removed foreign key (post_id)(post_id) on table album_photos
INFO [alembic.autogenerate.compare] Detected removed foreign key (album_id)(album_id) on table album_photos
INFO [alembic.autogenerate.compare] Detected removed foreign key (user_id)(user_id) on table album_photos
INFO [alembic.autogenerate.compare] Detected added foreign key (album_id)(album_id) on table prodcat.album_photos
INFO [alembic.autogenerate.compare] Detected added foreign key (post_id)(post_id) on table prodcat.album_photos
INFO [alembic.autogenerate.compare] Detected added foreign key (user_id)(user_id) on table prodcat.album_photos
I have tried adding name to each Foreign Key constraint but that doesn't have any effect. My tables reside in multiple Postgresql Schemas and I have hardcoded the schema information in each model class like this
class AlbumPhotos(db.Model, TimeStampMixin, HasLikes, HasComments):
__tablename__ = 'album_photos'
__table_args__ = {'schema' : 'prodcat'}
id = db.Column('photo_id',db.Integer, primary_key=True)
Here is more detail explanation of the problem http://stackoverflow.com/questions/41150956/alembic-not-generating-correct-changes
该提问来源于开源项目:sqlalchemy/alembic