From 2a3e418f5bc7e3f5badfe52d11839b1960c05f6c Mon Sep 17 00:00:00 2001 From: Tim Lorsbach Date: Tue, 11 Nov 2025 15:24:09 +0100 Subject: [PATCH] added missing migrations --- .gitea/workflows/ci.yaml | 5 ----- epdb/migrations/0010_license_cc_string.py | 18 +++++++++++++++ epdb/migrations/0011_auto_20251111_1413.py | 26 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 epdb/migrations/0010_license_cc_string.py create mode 100644 epdb/migrations/0011_auto_20251111_1413.py diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index c8ea35e4..2ab32386 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -105,11 +105,6 @@ jobs: until pg_isready -h postgres -U postgres; do sleep 2; done # until redis-cli -h redis ping; do sleep 2; done - - name: Make Django Migrations - run: | - source .venv/bin/activate - python manage.py makemigrations --noinput - - name: Run Django Migrations run: | source .venv/bin/activate diff --git a/epdb/migrations/0010_license_cc_string.py b/epdb/migrations/0010_license_cc_string.py new file mode 100644 index 00000000..5594c756 --- /dev/null +++ b/epdb/migrations/0010_license_cc_string.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-11-11 14:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("epdb", "0009_joblog"), + ] + + operations = [ + migrations.AddField( + model_name="license", + name="cc_string", + field=models.TextField(default="by-nc-sa", verbose_name="CC string"), + preserve_default=False, + ), + ] diff --git a/epdb/migrations/0011_auto_20251111_1413.py b/epdb/migrations/0011_auto_20251111_1413.py new file mode 100644 index 00000000..4d60ed39 --- /dev/null +++ b/epdb/migrations/0011_auto_20251111_1413.py @@ -0,0 +1,26 @@ +# Generated by Django 5.2.7 on 2025-11-11 14:13 + +import re + +from django.db import migrations + + +def set_cc(apps, schema_editor): + License = apps.get_model("epdb", "License") + for license in License.objects.all(): + pattern = r"/licenses/([^/]+)/4\.0" + match = re.search(pattern, license.link) + if match: + license.cc_string = match.group(1) + license.save() + else: + print(f"Could not find license for {license.link}") + raise ValueError() + + +class Migration(migrations.Migration): + dependencies = [ + ("epdb", "0010_license_cc_string"), + ] + + operations = [migrations.RunPython(set_cc)]