From 3e365324fdb718afa614ee39c5cfb590955b9a4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <gitlab@cmatte.me>
Date: Wed, 22 Mar 2023 10:25:41 +0100
Subject: [PATCH 3/3] Bugfix: set a default value for loaderror column "dat"

A default value for this column is set in django with auto_now_add, but this
default is not taken into account when django's ORM is not used, such as in
load_message.py, which leads to crashes
---
 django/archives/mailarchives/migrations/0005_merge_schema.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/django/archives/mailarchives/migrations/0005_merge_schema.py b/django/archives/mailarchives/migrations/0005_merge_schema.py
index b5ce31f..ef38743 100644
--- a/django/archives/mailarchives/migrations/0005_merge_schema.py
+++ b/django/archives/mailarchives/migrations/0005_merge_schema.py
@@ -100,6 +100,7 @@ class Migration(migrations.Migration):
         migrations.RunSQL("CREATE UNIQUE INDEX idx_unresolved_msgid_message ON unresolved_messages(msgid, message);"),
         migrations.RunSQL("CREATE INDEX list_threads_listid_idx ON list_threads(listid);"),
         migrations.RunSQL("CREATE INDEX idx_attachments_msg ON attachments(message);"),
+        migrations.RunSQL("ALTER TABLE loaderrors ALTER COLUMN dat SET DEFAULT NOW();"),
         migrations.RunSQL("""
 CREATE TEXT SEARCH CONFIGURATION pg (COPY = pg_catalog.english);
 
-- 
2.39.2

