Skip to content

Commit

Permalink
Altering the #10 migration as it caused strange behavior with data.
Browse files Browse the repository at this point in the history
  • Loading branch information
coordt committed Mar 28, 2012
1 parent d2f5d4d commit 43f7ff7
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,23 @@
class Migration(SchemaMigration):

def forwards(self, orm):

# Changing field 'Category.parent'
db.alter_column('categories_category', 'parent_id', self.gf('mptt.fields.TreeForeignKey')(null=True, to=orm['categories.Category']))

# Changing field 'Category.order'
db.alter_column('categories_category', 'order', self.gf('django.db.models.fields.IntegerField')())

# Deleting field 'CategoryRelation.story'
db.delete_column('categories_categoryrelation', 'story_id')

# Adding field 'CategoryRelation.category'
db.add_column('categories_categoryrelation', 'category', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['categories.Category']), keep_default=False)
db.add_column('categories_categoryrelation', 'category', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['categories.Category']))


def backwards(self, orm):

# Changing field 'Category.parent'
db.alter_column('categories_category', 'parent_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['categories.Category']))

# Changing field 'Category.order'
db.alter_column('categories_category', 'order', self.gf('django.db.models.fields.IntegerField')(null=True))

# User chose to not deal with backwards NULL issues for 'CategoryRelation.story'
raise RuntimeError("Cannot reverse this migration. 'CategoryRelation.story' and its values cannot be restored.")


# Deleting field 'CategoryRelation.category'
db.delete_column('categories_categoryrelation', 'category_id')

Expand Down Expand Up @@ -60,11 +52,12 @@ def backwards(self, orm):
},
'categories.categoryrelation': {
'Meta': {'object_name': 'CategoryRelation'},
'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['categories.Category']"}),
'category': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'new_cats'", 'null': 'True', 'to': "orm['categories.Category']"}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'relation_type': ('django.db.models.fields.CharField', [], {'max_length': "'200'", 'null': 'True', 'blank': 'True'})
'relation_type': ('django.db.models.fields.CharField', [], {'max_length': "'200'", 'null': 'True', 'blank': 'True'}),
'story': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['categories.Category']"})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
Expand Down

0 comments on commit 43f7ff7

Please sign in to comment.