From: Radek Czajka Date: Tue, 17 Dec 2013 12:04:32 +0000 (+0100) Subject: remove some indexes X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/71b0bebea369ab07e2d1a64a2376aba1f98c5a6f?hp=7ae251c4e5d11be3f6d7999a0d72413c724d0a98 remove some indexes --- diff --git a/questions/migrations/0007_auto.py b/questions/migrations/0007_auto.py new file mode 100644 index 0000000..3d6c165 --- /dev/null +++ b/questions/migrations/0007_auto.py @@ -0,0 +1,75 @@ +# -*- coding: 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): + # Removing index on 'Question', fields ['question'] + db.delete_index('questions_question', ['question']) + + # Removing index on 'Question', fields ['edited_question'] + db.delete_index('questions_question', ['edited_question']) + + + def backwards(self, orm): + # Adding index on 'Question', fields ['edited_question'] + db.create_index('questions_question', ['edited_question']) + + # Adding index on 'Question', fields ['question'] + db.create_index('questions_question', ['question']) + + + models = { + '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'}) + }, + 'questions.question': { + 'Meta': {'ordering': "['-created_at']", 'object_name': 'Question'}, + '_answer_rendered': ('django.db.models.fields.TextField', [], {}), + 'answer': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True', 'blank': 'True'}), + 'answer_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), + 'answered': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'answered_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'answered_by': ('django.db.models.fields.CharField', [], {'max_length': '127', 'null': 'True', 'blank': 'True'}), + 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'edited_question': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'published': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'published_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'question': ('django.db.models.fields.TextField', [], {}) + }, + 'questions.tag': { + 'Meta': {'object_name': 'Tag'}, + 'category': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tags'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['questions.TagCategory']"}), + 'click_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'questions.tagcategory': { + 'Meta': {'object_name': 'TagCategory'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100'}) + }, + 'questions.tagitem': { + 'Meta': {'object_name': 'TagItem'}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'questions_tagitem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['questions.Tag']"}) + } + } + + complete_apps = ['questions'] \ No newline at end of file diff --git a/questions/models.py b/questions/models.py index f00afc1..278071e 100644 --- a/questions/models.py +++ b/questions/models.py @@ -45,11 +45,11 @@ class TagItem(GenericTaggedItemBase): class Question(models.Model): email = models.EmailField(_('contact e-mail'), null=True, blank=True) - question = models.TextField(_('question'), db_index=True) + question = models.TextField(_('question'), db_index=False) created_at = models.DateTimeField(_('created at'), auto_now_add=True) changed_at = models.DateTimeField(_('changed at'), auto_now=True) approved = models.BooleanField(_('approved'), default=False) - edited_question = models.TextField(_('edited question'), db_index=True, null=True, blank=True, + edited_question = models.TextField(_('edited question'), db_index=False, null=True, blank=True, help_text=_("Leave empty if question doesn't need editing.")) answer = MarkupField(_('answer'), markup_type='textile_pl', blank=True, help_text=_('Use Textile syntax.'))