From b3f441f2cd4944c44f3a077e415dc682cd651152 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Fri, 13 Jun 2025 17:13:38 +0200 Subject: [PATCH] add basic migrations Signed-off-by: Marc 'risson' Schmitt --- ...ame_meta_icon_application_meta_old_icon.py | 44 +++++++++++++++++++ authentik/core/models.py | 3 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 authentik/core/migrations/0049_file_rename_meta_icon_application_meta_old_icon.py diff --git a/authentik/core/migrations/0049_file_rename_meta_icon_application_meta_old_icon.py b/authentik/core/migrations/0049_file_rename_meta_icon_application_meta_old_icon.py new file mode 100644 index 0000000000..36f1a8e872 --- /dev/null +++ b/authentik/core/migrations/0049_file_rename_meta_icon_application_meta_old_icon.py @@ -0,0 +1,44 @@ +# Generated by Django 5.1.11 on 2025-06-13 15:12 + +import uuid +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_core", "0048_delete_oldauthenticatedsession_content_type"), + ] + + operations = [ + migrations.CreateModel( + name="File", + fields=[ + ( + "id", + models.UUIDField( + default=uuid.uuid4, editable=False, primary_key=True, serialize=False + ), + ), + ("name", models.TextField()), + ("content", models.BinaryField()), + ("public", models.BooleanField(default=False)), + ], + options={ + "verbose_name": "Files", + }, + ), + migrations.RenameField( + model_name="application", + old_name="meta_icon", + new_name="meta_old_icon", + ), + migrations.AddField( + model_name="application", + name="meta_icon", + field=models.ForeignKey( + null=True, on_delete=django.db.models.deletion.SET_NULL, to="authentik_core.file" + ), + ), + ] diff --git a/authentik/core/models.py b/authentik/core/models.py index e82bbea38b..72c28835fa 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -533,12 +533,13 @@ class Application(SerializerModel, PolicyBindingModel): ) # For template applications, this can be set to /static/authentik/applications/* - meta_icon = models.FileField( + meta_old_icon = models.FileField( upload_to="application-icons/", default=None, null=True, max_length=500, ) + meta_icon = models.ForeignKey("File", null=True, on_delete=models.SET_NULL) meta_description = models.TextField(default="", blank=True) meta_publisher = models.TextField(default="", blank=True)