Skip to content
Snippets Groups Projects
Commit a0d35acb authored by Todd Dembrey's avatar Todd Dembrey Committed by Fredrik Jonsson
Browse files

Add index on source_object_id for 10x performance improvment on orderBy

parent 2af690f8
No related branches found
No related tags found
No related merge requests found
# Generated by Django 2.1.11 on 2019-11-12 12:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activity', '0048_add_project_transition'),
]
operations = [
migrations.AlterField(
model_name='activity',
name='source_object_id',
field=models.PositiveIntegerField(blank=True, db_index=True, null=True),
),
]
......@@ -90,7 +90,7 @@ class Activity(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT)
source_content_type = models.ForeignKey(ContentType, blank=True, null=True, on_delete=models.CASCADE, related_name='activity_source')
source_object_id = models.PositiveIntegerField(blank=True, null=True)
source_object_id = models.PositiveIntegerField(blank=True, null=True, db_index=True)
source = GenericForeignKey('source_content_type', 'source_object_id')
message = models.TextField()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment