From 950bc21d8719e28ceb0afac99d204f10d491aef5 Mon Sep 17 00:00:00 2001 From: Seth Ladygo Date: Tue, 23 Apr 2019 17:03:00 -0700 Subject: [PATCH] add some Catalog field indexes --- procat2/migrations/0004_auto_20190424_0000.py | 23 +++++++++++++++++++ procat2/models.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 procat2/migrations/0004_auto_20190424_0000.py diff --git a/procat2/migrations/0004_auto_20190424_0000.py b/procat2/migrations/0004_auto_20190424_0000.py new file mode 100644 index 0000000..8fa104b --- /dev/null +++ b/procat2/migrations/0004_auto_20190424_0000.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2 on 2019-04-24 00:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('procat2', '0003_auto_20190423_2203'), + ] + + operations = [ + migrations.AlterField( + model_name='catalog', + name='public', + field=models.BooleanField(db_index=True, default=False), + ), + migrations.AlterField( + model_name='catalog', + name='updated', + field=models.DateTimeField(auto_now=True, db_index=True), + ), + ] diff --git a/procat2/models.py b/procat2/models.py index bca73d6..5813e5c 100644 --- a/procat2/models.py +++ b/procat2/models.py @@ -21,9 +21,9 @@ class Catalog(models.Model): season = models.ForeignKey(Season, on_delete=models.PROTECT) region = models.ForeignKey(Region, on_delete=models.PROTECT) created = models.DateTimeField(auto_now_add=True) - updated = models.DateTimeField(auto_now=True) + updated = models.DateTimeField(auto_now=True, db_index=True) name = models.CharField(max_length=300) - public = models.BooleanField(default=False) + public = models.BooleanField(default=False, db_index=True) pages = models.PositiveIntegerField(default=0) sections = models.PositiveIntegerField(default=0) materials = models.PositiveIntegerField(default=0)