← Back to team overview

harvest-dev team mailing list archive

[Merge] lp:~dholbach/harvest/add-indexes into lp:harvest

 

Daniel Holbach has proposed merging lp:~dholbach/harvest/add-indexes into lp:harvest.

Requested reviews:
  harvest-dev (harvest-dev)
Related bugs:
  Bug #827874 in harvest: "Loading '/' is too expensive"
  https://bugs.launchpad.net/harvest/+bug/827874

For more details, see:
https://code.launchpad.net/~dholbach/harvest/add-indexes/+merge/72164
-- 
https://code.launchpad.net/~dholbach/harvest/add-indexes/+merge/72164
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/add-indexes into lp:harvest.
=== added file 'harvest/opportunities/migrations/0003_add_indexes.py'
--- harvest/opportunities/migrations/0003_add_indexes.py	1970-01-01 00:00:00 +0000
+++ harvest/opportunities/migrations/0003_add_indexes.py	2011-08-19 10:42:10 +0000
@@ -0,0 +1,128 @@
+# 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):
+        
+        # Adding index on 'Opportunity', fields ['last_updated']
+        db.create_index('opportunities_opportunity', ['last_updated'])
+
+        # Adding index on 'Opportunity', fields ['valid']
+        db.create_index('opportunities_opportunity', ['valid'])
+
+        # Adding index on 'OpportunityList', fields ['last_updated']
+        db.create_index('opportunities_opportunitylist', ['last_updated'])
+    
+    
+    def backwards(self, orm):
+        
+        # Removing index on 'Opportunity', fields ['last_updated']
+        db.delete_index('opportunities_opportunity', ['last_updated'])
+
+        # Removing index on 'Opportunity', fields ['valid']
+        db.delete_index('opportunities_opportunity', ['valid'])
+
+        # Removing index on 'OpportunityList', fields ['last_updated']
+        db.delete_index('opportunities_opportunitylist', ['last_updated'])
+    
+    
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        'contenttypes.contenttype': {
+            'Meta': {'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'})
+        },
+        'opportunities.actionlogentry': {
+            'Meta': {'object_name': 'ActionLogEntry'},
+            'action': ('django.db.models.fields.TextField', [], {'max_length': '200'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'opportunity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['opportunities.Opportunity']", 'blank': 'True'}),
+            'timestamp': ('django.db.models.fields.DateTimeField', [], {}),
+            'who': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
+        },
+        'opportunities.note': {
+            'Meta': {'object_name': 'Note'},
+            'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
+            'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'opportunity': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['opportunities.Opportunity']"}),
+            'text': ('django.db.models.fields.CharField', [], {'max_length': '250'})
+        },
+        'opportunities.opportunity': {
+            'Meta': {'object_name': 'Opportunity'},
+            'applied': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'max_length': '350'}),
+            'experience': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'last_updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}),
+            'long_description': ('django.db.models.fields.TextField', [], {'max_length': '350', 'null': 'True'}),
+            'opportunitylist': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['opportunities.OpportunityList']"}),
+            'reviewed': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'severity': ('django.db.models.fields.TextField', [], {'max_length': '20', 'null': 'True'}),
+            'since': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+            'sourcepackage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['opportunities.SourcePackage']"}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '350'}),
+            'valid': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True', 'blank': 'True'})
+        },
+        'opportunities.opportunitylist': {
+            'Meta': {'object_name': 'OpportunityList'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'commentable': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'max_length': '350'}),
+            'experience': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'explanation': ('django.db.models.fields.URLField', [], {'max_length': '500', 'null': 'True'}),
+            'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'last_updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}),
+            'name': ('django.db.models.fields.SlugField', [], {'max_length': '70', 'db_index': 'True'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+        },
+        'opportunities.packageset': {
+            'Meta': {'object_name': 'PackageSet'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.SlugField', [], {'max_length': '40', 'db_index': 'True'})
+        },
+        'opportunities.sourcepackage': {
+            'Meta': {'object_name': 'SourcePackage'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.SlugField', [], {'max_length': '70', 'db_index': 'True'}),
+            'packagesets': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['opportunities.PackageSet']", 'null': 'True', 'symmetrical': 'False'})
+        }
+    }
+    
+    complete_apps = ['opportunities']

=== modified file 'harvest/opportunities/models.py'
--- harvest/opportunities/models.py	2011-06-28 13:42:41 +0000
+++ harvest/opportunities/models.py	2011-08-19 10:42:10 +0000
@@ -37,7 +37,7 @@
     name = models.SlugField(_("Name"), max_length=70)
     url = models.URLField(_("URL"), verify_exists=False)
     description = models.TextField(_("Description"), max_length=350)
-    last_updated = models.DateTimeField(_("Last Updated"), null=True)
+    last_updated = models.DateTimeField(_("Last Updated"), null=True, db_index=True)
     active = models.BooleanField(_("Active"), default=True)
     featured = models.BooleanField(_("Featured"), default=False, 
                                    help_text=_("Specially feature this list of opportunities?"))
@@ -76,13 +76,13 @@
 class Opportunity(models.Model):
     description = models.TextField(_("Description"), max_length=350)
     url = models.URLField(_("URL"), max_length=350, verify_exists=False)
-    last_updated = models.DateTimeField(_("Last Updated"), null=True)
+    last_updated = models.DateTimeField(_("Last Updated"), null=True, db_index=True)
     since = models.DateTimeField(_("Since"), help_text=_("On the list since"), null=True)
     reviewed = models.BooleanField(_("Irrelevant"), default=False, blank=True)
     applied = models.BooleanField(_("Applied"), default=False, blank=True)
     sourcepackage = models.ForeignKey(SourcePackage)
     opportunitylist = models.ForeignKey(OpportunityList)
-    valid = models.BooleanField(_("Valid"), default=True)
+    valid = models.BooleanField(_("Valid"), default=True, db_index=True)
     experience = models.IntegerField(_("Difficulty"), choices=EXPERIENCE_CHOICES, default=0,
                                      help_text=_("Level of experience required for this specific opportunity."))
     long_description = models.TextField(_("Long Description"), max_length=350, null=True)


Follow ups