mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Altering the #10 migration as it caused strange behavior with data.
This commit is contained in:
parent
d2f5d4da3f
commit
43f7ff768d
1 changed files with 5 additions and 12 deletions
|
|
@ -7,31 +7,23 @@ from django.db import models
|
|||
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')
|
||||
|
||||
|
|
@ -60,11 +52,12 @@ class Migration(SchemaMigration):
|
|||
},
|
||||
'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'"},
|
||||
Loading…
Reference in a new issue