You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by Ezak91 November 10, 2023
We have a larger project with flask, sqlalchemy and flask-migrate (alembic).
We have completely recreated and migrated the database. If I perform another migrate immediately afterwards, it wants to delete all foreignkeys and create them again.
Before we used schema, it worked. But now we have to use schema and have the problem.
INFO [alembic.env] Migrating database Customer
INFO [alembic.runtime.migration] Context impl MSSQLImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
INFO [alembic.autogenerate.compare] Detected removed foreign key (customer_id)(_id) on table customer_address
INFO [alembic.autogenerate.compare] Detected added foreign key (customer_id)(_id) on table dbo.customer_address
defupgrade_Customer():
# ### commands auto generated by Alembic - please adjust! ###withop.batch_alter_table('customer_address', schema=None) asbatch_op:
batch_op.drop_constraint('fk_customer_address_customer_id_customer', type_='foreignkey')
batch_op.create_foreign_key(batch_op.f('fk_customer_address_customer_id_customer'), 'customer', ['customer_id'], ['_id'], referent_schema='dbo')
# ### end Alembic commands ###defdowngrade_Customer():
# ### commands auto generated by Alembic - please adjust! ###withop.batch_alter_table('customer_address', schema=None) asbatch_op:
batch_op.drop_constraint(batch_op.f('fk_customer_address_customer_id_customer'), type_='foreignkey')
batch_op.create_foreign_key('fk_customer_address_customer_id_customer', 'customer', ['customer_id'], ['_id'])
Can anyone help?
Kind regards
The text was updated successfully, but these errors were encountered:
Discussed in #1351
Originally posted by Ezak91 November 10, 2023
We have a larger project with flask, sqlalchemy and flask-migrate (alembic).
We have completely recreated and migrated the database. If I perform another migrate immediately afterwards, it wants to delete all foreignkeys and create them again.
Before we used schema, it worked. But now we have to use schema and have the problem.
Database: MSSQL
alembic==1.11.1
Flask-Migrate==4.0.5
Flask-SQLAlchemy==2.5.1
It has multibe db (init --multidb)
and references to remote database on the same server in some relationship
Example:
Model
Initial Migrate
second migrate
Can anyone help?
Kind regards
The text was updated successfully, but these errors were encountered: