使用django执行数据更新命令时报错:django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.00 01_initial on database 'default'.
如果在重新封装更新用户表之前,已经更新了数据表,在数据库中已经有了django相关的依赖表,就会报错:
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.00 01_initial on database 'default'.
解决方案:
将mysql数据库里删除与项目连接的数据库(本项目的数据库是gg),然后再重新建立数据库,然后再在pycharm中migrate
drop database gg; create database gg default character set utf8 collate utf8_general_ci;