correct last migration
authorymh <ymh.work@gmail.com>
Wed, 16 Sep 2015 23:24:46 +0200
changeset 286 143e01b3d77e
parent 285 0a040e3149c2
child 287 02bff1b894c2
correct last migration
src/ldtplatform/migrations/0002_correct_oauth_provider_migration.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldtplatform/migrations/0002_correct_oauth_provider_migration.py	Wed Sep 16 23:24:46 2015 +0200
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+def update_oauth_provider_migration(apps, schema_editor):
+    from django.db.migrations.recorder import MigrationRecorder
+    count = MigrationRecorder.Migration.objects.filter(app='oauth_provider', name='0001_correct_oauth_provider_secret_size').count()
+    for r in MigrationRecorder.Migration.objects.filter(app='oauth_provider', name='0001_correct_oauth_provider_secret_size')[0:count-1]:
+        r.delete()
+    MigrationRecorder.Migration.objects.filter(app='oauth_provider', name='0001_correct_oauth_provider_secret_size').update(app='ldtplatform')
+
+def update_oauth_provider_migration_back(apps, schema_editor):
+    from django.db.migrations.recorder import MigrationRecorder
+    MigrationRecorder.Migration.objects.filter(app='ldtplatform', name='0001_correct_oauth_provider_secret_size').update(app='oauth_provider')
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('ldtplatform', '0001_correct_oauth_provider_secret_size'),
+    ]
+
+    operations = [
+        migrations.RunPython(update_oauth_provider_migration, update_oauth_provider_migration_back),
+    ]