fixing dependencies caused by changing a foreign key.
authorBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:38:12 +0000 (03:38 -0500)
committerBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:38:12 +0000 (03:38 -0500)
karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py
karmaworld/apps/users/migrations/0002_auto__del_karmauser__add_userprofile.py

index 2f71f2dc5e765a2c26822b121b75b75ef3856685..770a1d04e47799e68b1368559ebc8605330a8c4b 100644 (file)
@@ -7,6 +7,10 @@ from django.db import models
 
 class Migration(SchemaMigration):
 
+    depends_on = (
+        ('karmauser', '0002_auto__del_karmauser__add_userprofile'),
+    )
+
     def forwards(self, orm):
 
         # Changing field 'Note.user'
@@ -138,4 +142,4 @@ class Migration(SchemaMigration):
         }
     }
 
-    complete_apps = ['notes']
\ No newline at end of file
+    complete_apps = ['notes']
index 57804931ab58203cca78252a5235633612cfba5c..da99aedd0229e166821bd44c8a2b97e64a9160a5 100644 (file)
@@ -3,11 +3,15 @@ import datetime
 from south.db import db
 from south.v2 import SchemaMigration
 from django.db import models
+from karmaworld.apps.notes.models import Note
 
 
 class Migration(SchemaMigration):
 
     def forwards(self, orm):
+        # Removing all possible FK dependencies on KarmaUser from Note
+        Note.objects.update(user=None)
+
         # Deleting model 'KarmaUser'
         db.delete_table('users_karmauser')
 
@@ -95,4 +99,4 @@ class Migration(SchemaMigration):
         }
     }
 
-    complete_apps = ['users']
\ No newline at end of file
+    complete_apps = ['users']