zoukankan      html  css  js  c++  java
  • 报错django.db.migrations.exceptions.InconsistentMigrationHistory

     

    Pycharm强大的功能总是让我很是着迷,比如它的makemigrations 和 migrate。

      然而某一次,当我再次敲下这熟悉的命令时,它报错了。。。。

     1 Traceback (most recent call last):
     2   File "H:PyCharm 2018.1.1helperspycharmdjango_manage.py", line 52, in <module>
     3     run_command()
     4   File "H:PyCharm 2018.1.1helperspycharmdjango_manage.py", line 46, in run_command
     5     run_module(manage_file, None, '__main__', True)
     6   File "h:python36Lib
    unpy.py", line 205, in run_module
     7     return _run_module_code(code, init_globals, run_name, mod_spec)
     8   File "h:python36Lib
    unpy.py", line 96, in _run_module_code
     9     mod_name, mod_spec, pkg_name, script_name)
    10   File "h:python36Lib
    unpy.py", line 85, in _run_code
    11     exec(code, run_globals)
    12   File "H:/PycharmProjects/untitledmanage.py", line 15, in <module>
    13     execute_from_command_line(sys.argv)
    14   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangocoremanagement\__init__.py", line 371, in execute_from_command_line
    15     utility.execute()
    16   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangocoremanagement\__init__.py", line 365, in execute
    17     self.fetch_command(subcommand).run_from_argv(self.argv)
    18   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangocoremanagementase.py", line 288, in run_from_argv
    19     self.execute(*args, **cmd_options)
    20   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangocoremanagementase.py", line 335, in execute
    21     output = self.handle(*args, **options)
    22   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangocoremanagementcommandsmigrate.py", line 82, in handle
    23     executor.loader.check_consistent_history(connection)
    24   File "C:UsersAdministratorEnvs	estvir1libsite-packagesdjangodbmigrationsloader.py", line 291, in check_consistent_history
    25     connection.alias,
    26 django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'.
    27 
    28 Process finished with exit code 1

    不想看上边的朋友我还截了个大图。

      错误是:django.db.migrations.exceptions.InconsistentMigrationHistory

     

      在试了一些其他方法后,我发现了一个最简单最暴力的解决方案:

        就是打开Navicat,把所有表删掉之后,再次输入 migrate ,回车,就OK了~~~

      

    一个佛系的博客更新者,随手写写,看心情吧 (っ•̀ω•́)っ✎⁾⁾
  • 相关阅读:
    Django Swagger接口文档生成
    基于docker快速搭建hbase集群
    Cassandra数据操作管理工具tableplus
    基于docker创建Cassandra集群
    基于docker快速搭建hive环境
    [20200623]应用报错:当前事务无法提交,而且无法支持写入日志文件的操作
    zabbix--监控 TCP 连接状态
    kubernetes 使用ceph实现动态持久卷存储
    MySQL备份脚本
    Linux Pam后门总结拓展
  • 原文地址:https://www.cnblogs.com/WoLykos/p/8886900.html
Copyright © 2011-2022 走看看