diff --git a/README.rst b/README.rst index 0e96431..a2c64d9 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,24 @@ Django Categories grew out of our need to provide a basic hierarchical taxonomy As a news site, our stories, photos, and other content get divided into "sections" and we wanted all the apps to use the same set of sections. As our needs grew, the Django Categories grew in the functionality it gave to category handling within web pages. +Upgrade path from 1.0.2 to 1.0.3 +================================ + +Due to some data corruption with 1.0.2 migrations, a partially new set of migrations has been written in 1.0.3; and this will cause issues for users on 1.0.2 version. + +For a clean upgrade from 1.0.2 to 1.0.3 you have to delete previous version of 0010 migration (named 0010_changed_category_relation.py) and fakes the new 00010, 0011 and 0012. + +Therefore after installing new version of django-categories, for each project to upgrade you should execute the following commans in order: + + python manage.py migrate categories 0010_add_field_categoryrelation_category --fake --delete-ghost-migrations + python manage.py migrate categories 0011_move_category_fks --fake + python manage.py migrate categories 0012_remove_story_field --fakes + python manage.py migrate categories 0013_null_category_id + +This way both the exact database layout and migration history is restored between the two installation paths (new installation from 1.0.3 and upgrade from 1.0.2 to 1.0.3). + +Last migration is needed to set the correct null value for `category_id` field when upgrading from 1.0.2 while is a noop for 1.0.3. + New in 1.0 ========== diff --git a/categories/migrations/0013_null_category_id.py b/categories/migrations/0013_null_category_id.py new file mode 100644 index 0000000..e59b463 --- /dev/null +++ b/categories/migrations/0013_null_category_id.py @@ -0,0 +1,59 @@ +# encoding: utf-8 +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting field 'CategoryRelation.story' + db.alter_column('categories_categoryrelation', 'category_id', self.gf('mptt.fields.TreeForeignKey')(null=True, to=orm['categories.Category'])) + + + + def backwards(self, orm): + # Adding field 'CategoryRelation.story' + db.add_column('categories_categoryrelation', 'category_id', self.gf('mptt.fields.TreeForeignKey')(null=True, to=orm['categories.Category'])) + + + models = { + 'categories.category': { + 'Meta': {'ordering': "('tree_id', 'lft')", 'unique_together': "(('parent', 'name'),)", 'object_name': 'Category'}, + 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'alternate_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100', 'blank': 'True'}), + 'alternate_url': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'meta_extra': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), + 'meta_keywords': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'order': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'parent': ('mptt.fields.TreeForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['categories.Category']"}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), + 'thumbnail': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + 'thumbnail_height': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'thumbnail_width': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + }, + 'categories.categoryrelation': { + 'Meta': {'object_name': 'CategoryRelation'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'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'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['categories']