Upgrade using tutor local quickstart throws django.db.migrations.exceptions.InconsistentMigrationHistory error

I tried to update my installation with ‘tutor local quickstart’. However I get an error as follows :

How do I run migrations to restore consistency in the database?

Traceback (most recent call last):
  File "./manage.py", line 123, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 86, in handle
  File "/openedx/venv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 299, in check_consistent_history
**django.db.migrations.exceptions.InconsistentMigrationHistory: Migration third_party_auth.0001_initial is applied before its dependency oauth2.0001_initial on database 'default'.**
Error: Command failed with status 1: docker-compose -f /home/USERNAME/.local/share/tutor/env/local/docker-compose.yml --project-name tutor_local -f /home/USERNAME/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

./manage.py lms create_oauth2_client \
    "http://androidapp.com" "http://androidapp.com/redirect" public \
    --client_id android --client_secret <KEY> \

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/

Thanks a lot for your help

1 Like

Which version are you upgrading from, and to?

I have a version : 3.12.6

I did a restart of the server and then did a tutor local quickstart and the error comes after the pullimages part.

I think, might be in the init command part(might be I am wrong)

Thanks @regis

@regis Looks like this happens when I move from Ironwood to Juniper

@rejithr9 did you ever get this working? I am running into this when trying to upgrade from Juniper to Koa.