手贱!使用django,在数据库直接删除了表

莫名其妙的错误。

删除了migreation文件,并且更换了数据库。

1.直接makemigrations + migrate    error: no change ??  WTF

2.makemigrations app   + migrate app   循环完成      no error, but can't use this project.    WTF  +1

3.makemigrations app1 + makemigrations app2 ...   migrate         oh, success.      what's happend ?

其原因是已经找到(删除数据库的所有表后,django迁移并不会生成django自带的表),可以:更换数据库后,可先makemigrations + migrate,

再次makemigrations app + migrate app   或者

只删除创建的表和删除django_migrations表格中关于 删除创建的表的记录就不会出错

原文地址:https://www.cnblogs.com/tangpg/p/9298041.html