From 9caa71c7fd01a792a0ae5a8c2814971429f2dbe5 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Mon, 2 Aug 2021 21:04:51 +0200 Subject: [PATCH] confirmation: Migration to add expiry_date - last step. With the previous steps, all Confirmation objects should have been migrated and the expiry_date field is being used for checking confirmation validity - so all that's left is to set the NOT NULL constraint on the column. --- .../0010_alter_confirmation_expiry_date.py | 18 ++++++++++++++++++ confirmation/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 confirmation/migrations/0010_alter_confirmation_expiry_date.py diff --git a/confirmation/migrations/0010_alter_confirmation_expiry_date.py b/confirmation/migrations/0010_alter_confirmation_expiry_date.py new file mode 100644 index 0000000000..793fcfeda5 --- /dev/null +++ b/confirmation/migrations/0010_alter_confirmation_expiry_date.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-08-02 19:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("confirmation", "0009_confirmation_expiry_date_backfill"), + ] + + operations = [ + migrations.AlterField( + model_name="confirmation", + name="expiry_date", + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/confirmation/models.py b/confirmation/models.py index c9f774bf81..1b851118d4 100644 --- a/confirmation/models.py +++ b/confirmation/models.py @@ -133,7 +133,7 @@ class Confirmation(models.Model): content_object = GenericForeignKey("content_type", "object_id") date_sent: datetime.datetime = models.DateTimeField(db_index=True) confirmation_key: str = models.CharField(max_length=40, db_index=True) - expiry_date: datetime.datetime = models.DateTimeField(db_index=True, null=True) + expiry_date: datetime.datetime = models.DateTimeField(db_index=True) realm: Optional[Realm] = models.ForeignKey(Realm, null=True, on_delete=CASCADE) # The following list is the set of valid types