From c89a0b4e400a95d9fcc7a3dc40cb68116cfe7ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 4 Feb 2019 22:44:35 +0200 Subject: [PATCH] Index the api_key fields. --- .../migrations/0026_auto_20190204_2042.py | 29 +++++++++++++++++++ hc/accounts/models.py | 4 +-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 hc/accounts/migrations/0026_auto_20190204_2042.py diff --git a/hc/accounts/migrations/0026_auto_20190204_2042.py b/hc/accounts/migrations/0026_auto_20190204_2042.py new file mode 100644 index 00000000..af423112 --- /dev/null +++ b/hc/accounts/migrations/0026_auto_20190204_2042.py @@ -0,0 +1,29 @@ +# Generated by Django 2.1.5 on 2019-02-04 20:42 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0025_remove_member_team'), + ] + + operations = [ + migrations.AlterField( + model_name='project', + name='api_key', + field=models.CharField(blank=True, db_index=True, max_length=128), + ), + migrations.AlterField( + model_name='project', + name='api_key_readonly', + field=models.CharField(blank=True, db_index=True, max_length=128), + ), + migrations.AlterField( + model_name='project', + name='code', + field=models.UUIDField(default=uuid.uuid4, unique=True), + ), + ] diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 5432a0a1..59e80b93 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -214,8 +214,8 @@ class Project(models.Model): code = models.UUIDField(default=uuid.uuid4, unique=True) name = models.CharField(max_length=200, blank=True) owner = models.ForeignKey(User, models.CASCADE) - api_key = models.CharField(max_length=128, blank=True) - api_key_readonly = models.CharField(max_length=128, blank=True) + api_key = models.CharField(max_length=128, blank=True, db_index=True) + api_key_readonly = models.CharField(max_length=128, blank=True, db_index=True) badge_key = models.CharField(max_length=150, unique=True) def __str__(self):