Skip to content
Snippets Groups Projects
Unverified Commit ab3b7f91 authored by Fredrik Jonsson's avatar Fredrik Jonsson Committed by GitHub
Browse files

Merge pull request #1685 from OpenTechFund/fix/gh-1665-add-idexd-source_object_id-activity

Add index on source_object_id for 10x performance improvment on orderBy
parents 10596a9c a0d35acb
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