-
Notifications
You must be signed in to change notification settings - Fork 8
Moving from south migrations to django migrations
Craig M. Stimmel edited this page Jan 30, 2019
·
4 revisions
Due to a model conflict between oauth_provider and django-oauth-plus (which installs as 'oauth_provider') this migration got a little tricky. Here's the steps we used to resolve:
-
Make a backup via sqldump:
mysqldump -u root -p spots > spots-20190116.sql
-
Merge to qa / master (specific to our deploy process)
-
Set a maintenance message on the scout client, I used this in the apache-https hook:
ErrorDocument 503 "Our website is temporarily closed for maintenance. It should reopen by..." RewriteEngine On RewriteRule .* - [R=503,L]
-
Delete all TrustedOAuthClients:
(virtualenv) $ ./manage.py shell Python 2.7.11 (default, Apr 5 2016, 10:16:50) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from spotseeker_server.models import TrustedOAuthClient >>> all = TrustedOAuthClient.objects.all() >>> for client in all: ... client.delete()
-
Drop all the 'oauth_provider' tables:
SET FOREIGN_KEY_CHECKS=0; DROP TABLE oauth_provider_consumer; DROP TABLE oauth_provider_nonce; DROP TABLE oauth_provider_scope; DROP TABLE oauth_provider_resource; DROP TABLE oauth_provider_token; SET FOREIGN_KEY_CHECKS=1;
-
Deploy to test / production - this includes a migration step which uses the --fake-initial flag (Added in Django 1.8.)
-
Create new consumers with the ./manage.py create_consumer command and add them to appropriate client settings.py.