django.db.migrations.exceptions.InconsistentMigrationHistory error occurs when installing kiwi tcms

376 Views Asked by At

Use kiwi tcms for some time, running Kiwi TCMS as a Docker container.

This week I upgrade kiwi tcms to latest version 6.2. When I execute command "docker exec -it kiwi_web /Kiwi/manage.py migrate", some error occurs as below. I'm not familiar with django and just use kiwi tcms as a tool. Anyone who can help this? Thanks a lot.

chencjdeMacBook-Air:Kiwi chencj$ docker exec -it kiwi_web /Kiwi/manage.py migrate Traceback (most recent call last): File "/Kiwi/manage.py", line 12, in execute_from_command_line(sys.argv) File "/venv/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/venv/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv self.execute(*args, **cmd_options) File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute output = self.handle(*args, **options) File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 85, in handle executor.loader.check_consistent_history(connection) File "/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 297, in check_consistent_history connection.alias, django.db.migrations.exceptions.InconsistentMigrationHistory: Migration linkreference.0001_squashed is applied before its dependency testruns.0004_squashed on database 'default'.

1

There are 1 best solutions below

0
On

This is essentially the same problem discussed in:

django.db.migrations.exceptions.InconsistentMigrationHistory error as part of 6.0.1 to 6.1 upgrade

and is solved by doing intermediate upgrades as shown in: http://kiwitcms.org/blog/kiwi-tcms-team/2018/11/02/kiwi-tcms-62/