Recover Dropped Table In Django : Table Doesn't Exist

Comment-out the model in models.py and other locations where the model is induced, else System-checks will fail

python manage.py makemigrations
python manage.py migrate --fake

**

comment-in your model in models.py
Run makemigrations and migrate again without using --fake

You are back on track.**

Note: This does not bring back the data lost when you dropped the table, it recreates the database table and allows further use of application


–fake

Tells Django to mark the migrations as having been applied or unapplied, but without actually running the SQL to change your database schema.

This is intended for advanced users to manipulate the current migration state directly if they’re manually applying changes; be warned that using --fake runs the risk of putting the migration state table into a state where manual recovery will be needed to make migrations run correctly.

发布了44 篇原创文章 · 获赞 2 · 访问量 1102
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览