我正在开发一个使用sqlalchemy和postgres数据库的flask应用程序。我正在使用flask-migrate迁移我的数据库。我不得不更改数据库中一个表的名称,当我尝试迁移(flask- migrate )时,我得到了一个错误
sqlalchemy.exc.InternalError: (psycopg2.InternalError) cannot drop table category_announcement_date because other objects depend on it
DETAIL: constraint announcement_dates_id_fkey on table announcement_dates depends on table category_announcement_date
HINT: Use DROP ... CASCADE to drop the dependent objects too.
[SQL: '\nDROP TABLE category_announcement_date']我不知道如何告诉flask-migrate这个问题,所以我想出了一个好主意,可以手动完成,所以我转到psql,按照错误消息的建议,将表和CASCADE命令一起删除。这一切都很好,但现在我不能完成迁移?运行升级时,我收到
python manage.py db upgrade
...
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) table "category_announcement_date" does not exist这可能是因为我刚刚手动删除了表?有谁知道我怎么才能摆脱这个烂摊子?谢谢你,卡尔
发布于 2016-04-02 23:46:28
好的,我注意到删除版本文件并重复迁移是不是就是让我们欢呼fl
https://stackoverflow.com/questions/36373897
复制相似问题