serious hacking to deal with existing FK data in Note ... cont'd
authorBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:53:44 +0000 (03:53 -0500)
committerBryan <btbonval@gmail.com>
Fri, 10 Jan 2014 08:53:44 +0000 (03:53 -0500)
karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py

index bbfd3f32f323984946e80718facacf5bfe6312bb..88e5d015252bd8c16e2af98223867841510d484b 100644 (file)
@@ -13,6 +13,10 @@ class Migration(SchemaMigration):
 
     def forwards(self, orm):
 
+        # Dealing with previous FK problem.
+        # Renaming column for 'Note.user' to match new field type.
+        db.rename_column('notes_note', 'user', 'user_id')
+
         # Changing field 'Note.user'
         db.alter_column('notes_note', 'user_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, on_delete=models.SET_NULL))
 
@@ -21,6 +25,10 @@ class Migration(SchemaMigration):
         # Changing field 'Note.user'
         db.alter_column('notes_note', 'user_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['users.KarmaUser'], null=True, on_delete=models.SET_NULL))
 
+        # Dealing with previous FK problem.
+        # Renaming column for 'Note.user' to match new field type.
+        db.rename_column('notes_note', 'user_id', 'user')
+
     models = {
         'auth.group': {
             'Meta': {'object_name': 'Group'},