From 0ac41e77e830fd5a64df6b46651cd1828d395fd7 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 27 Jan 2021 14:38:10 +0200 Subject: [PATCH] Fix DB errors when using MySQL/MariaDB. Fixes #69. --- .../migrations/0037_auto_20210127_1237.py | 18 ++++++++++++++++++ django_etebase/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 django_etebase/migrations/0037_auto_20210127_1237.py diff --git a/django_etebase/migrations/0037_auto_20210127_1237.py b/django_etebase/migrations/0037_auto_20210127_1237.py new file mode 100644 index 0000000..06c31b2 --- /dev/null +++ b/django_etebase/migrations/0037_auto_20210127_1237.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.1 on 2021-01-27 12:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('django_etebase', '0036_auto_20201214_1128'), + ] + + operations = [ + migrations.AlterField( + model_name='collectiontype', + name='uid', + field=models.BinaryField(db_index=True, editable=True, max_length=1024, unique=True), + ), + ] diff --git a/django_etebase/models.py b/django_etebase/models.py index fa56a95..4640e6d 100644 --- a/django_etebase/models.py +++ b/django_etebase/models.py @@ -36,7 +36,7 @@ def stoken_annotation_builder(stoken_id_fields: t.List[str]): class CollectionType(models.Model): owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) - uid = models.BinaryField(editable=True, blank=False, null=False, db_index=True, unique=True) + uid = models.BinaryField(editable=True, blank=False, null=False, db_index=True, unique=True, max_length=1024) objects: models.manager.BaseManager["CollectionType"]