0

I am using flask and Postgres DB, I have deleted some columns from my model in flask code when I am doing db upgrade getting this error -

INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 9a57968ad4f7, remove some columns
Traceback (most recent call last):
  File "/home/veerendhar/PycharmProjects/erp-be/venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context
    cursor, statement, parameters, context
  File "/home/veerendhar/PycharmProjects/erp-be/venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.DependentObjectsStillExist: cannot drop table session because other objects depend on it
DETAIL:  constraint session_message_sessionId_fkey on table session_message depends on table session
HINT:  Use DROP ... CASCADE to drop the dependent objects too.


How I can fix it...?

Mohammad Aarif
  • 1,619
  • 13
  • 19
  • Possible duplicate of [flask-migrate cannot drop table because other objects depend on it](https://stackoverflow.com/questions/49430570/flask-migrate-cannot-drop-table-because-other-objects-depend-on-it) – Adrian Krupa Oct 01 '19 at 07:30
  • 1
    You can watch this [link](https://stackoverflow.com/questions/53047429/how-to-use-flask-migrate-to-do-database-migration/53049045#53049045) – Tobin Oct 01 '19 at 10:56

0 Answers0