From e3614ad9f8b57169a371a1e5533de3df65ed05cc Mon Sep 17 00:00:00 2001 From: Bryan Date: Fri, 10 Jan 2014 03:53:44 -0500 Subject: [PATCH] serious hacking to deal with existing FK data in Note ... cont'd --- .../notes/migrations/0013_auto__chg_field_note_user.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py b/karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py index bbfd3f3..88e5d01 100644 --- a/karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py +++ b/karmaworld/apps/notes/migrations/0013_auto__chg_field_note_user.py @@ -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'}, -- 2.25.1