Fix hashval NULLability
authorMagnus Hagander <magnus@hagander.net>
Tue, 16 Apr 2024 21:01:52 +0000 (23:01 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 16 Apr 2024 21:02:26 +0000 (23:02 +0200)
Needs to allow NULL on INSERT, which will then get overwritten by the
trigger.

postgresqleu/util/migrations/0006_alter_storage_hashval.py [new file with mode: 0644]
postgresqleu/util/models.py

diff --git a/postgresqleu/util/migrations/0006_alter_storage_hashval.py b/postgresqleu/util/migrations/0006_alter_storage_hashval.py
new file mode 100644 (file)
index 0000000..f10f474
--- /dev/null
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.14 on 2024-04-16 21:01
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('util', '0005_storage_hashval'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='storage',
+            name='hashval',
+            field=models.BinaryField(null=True),
+        ),
+    ]
index 8700dc5f5ea082fe73785e09b2dc91a5aa0cf1f2..511293e754be262d6ab7b6ebba04b4ec43dce0a7 100644 (file)
@@ -6,7 +6,7 @@ class Storage(models.Model):
     key = models.CharField(max_length=16, null=False, blank=False)
     storageid = models.IntegerField(null=False, blank=False)
     data = models.BinaryField(null=False, blank=False)
-    hashval = models.BinaryField(null=False, blank=False)
+    hashval = models.BinaryField(null=True, blank=False)
 
     class Meta:
         unique_together = (