From 581b1869e337d68701cce547ccf290f792bc81e0 Mon Sep 17 00:00:00 2001 From: Matt Bertrand Date: Tue, 23 Jul 2024 13:23:08 -0400 Subject: [PATCH] Add a database index on FeedEventDetail.event_datetime (#1304) --- ...0003_alter_feedeventdetail_event_datetime.py | 17 +++++++++++++++++ news_events/models.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 news_events/migrations/0003_alter_feedeventdetail_event_datetime.py diff --git a/news_events/migrations/0003_alter_feedeventdetail_event_datetime.py b/news_events/migrations/0003_alter_feedeventdetail_event_datetime.py new file mode 100644 index 0000000000..8f8a790d56 --- /dev/null +++ b/news_events/migrations/0003_alter_feedeventdetail_event_datetime.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.14 on 2024-07-17 14:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("news_events", "0002_alter_feeditem_guid"), + ] + + operations = [ + migrations.AlterField( + model_name="feedeventdetail", + name="event_datetime", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/news_events/models.py b/news_events/models.py index b0587ef59a..737f461026 100644 --- a/news_events/models.py +++ b/news_events/models.py @@ -63,7 +63,7 @@ class FeedEventDetail(TimestampedModel): audience = ArrayField(models.CharField(max_length=255, blank=True)) location = ArrayField(models.CharField(max_length=255, blank=True)) event_type = ArrayField(models.CharField(max_length=255, blank=True)) - event_datetime = models.DateTimeField() + event_datetime = models.DateTimeField(db_index=True) class FeedNewsDetail(TimestampedModel):