Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Staging Application Migration Instructions

Daniel Chiquito edited this page Jun 30, 2021 · 1 revision

First, on the most recent stable commit, reset the oauth2_provider migrations:

git checkout 986d07b1ff48442d8e31013febe0e921443a3615 # The most recent commit with a reasonable migration state
python manage.py migrate --fake oauth2_provider zero

This won't modify the DB, it will just modify Django's state tracking for migrations.

Next, attempt the migration again:

git checkout master
python manage.py migrate api

This will successfully apply migration 0011..., since that now comes before the first oauth2_provider migration, but will fail to apply the subsequent oauth2_provider migrations since those tables already exist.

Note: For Heroku instances, to run this migrate command, you will need to attempt to deploy the app. This will build your application, bundle it, and attempt to deploy it. The first step of the deploy process is to run python manage.py migrate, which will suffice for our purposes.

Next, un-fake the oauth2_provider migrations:

git checkout 986d07b1ff48442d8e31013febe0e921443a3615
python manage.py migrate --fake

This will restore the oauth2_provider migrations that always existed in the DB.

The migration state should be fixed now, so you can now attempt the final migration again:

git checkout master
python manage.py migrate
Clone this wiki locally