执行migrate报错:django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency blog. 0001_initial on database 'default'.
报错
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency blog. 0001_initial on database 'default'.
报错原因
在数据库中已经有了django相关的依赖表
解决
ps: 慎用该方法,我这里是刚新建数据库,内无数据
- MySQL删除相应数据库(如:django_bbs)
drop database django_bbs;
- MySQL中新建数据库
create database django_bbs;
- pycharm中重新执行migrate
python manage.py migrate