this should do the trick, somehow clearing Note.user values got lost
authorBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:59:30 +0000 (03:59 -0500)
committerBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:59:30 +0000 (03:59 -0500)
karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py
karmaworld/apps/users/migrations/0002_auto__del_karmauser__add_userprofile.py

index 88e5d015252bd8c16e2af98223867841510d484b..fa418f668eb632b038d449d96acb05e6a8b33848 100644 (file)
@@ -3,6 +3,7 @@ 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):
@@ -14,6 +15,9 @@ class Migration(SchemaMigration):
     def forwards(self, orm):
 
         # Dealing with previous FK problem.
+        # Remove all previous foreign keys which will shortly point at the
+        # wrong thing. Unrecoverable change.
+        Note.objects.update(user=None)
         # Renaming column for 'Note.user' to match new field type.
         db.rename_column('notes_note', 'user', 'user_id')
 
index b4404d8782f3c265cd877c6ac6c5ed6f1c66fb3f..45c867403bafd4146ad014c42a60263d58f385ad 100644 (file)
@@ -3,8 +3,6 @@ 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):