# Generated by Django 5.2.1 on 2025-05-18 18:19

import aleksis.core.mixins
import ckeditor.fields
import colorfield.fields
import django.contrib.postgres.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


def adapt_guardian_role(apps, schema_editor):
    RoleModel = apps.get_model('core', 'Role')

    db_alias = schema_editor.connection.alias

    guardian_role, _ = RoleModel.objects.get_or_create(
        managed_by_app_label="core",
        short_name="guardian",
        defaults={"name": "Guardian", "reciprocal_name": "Child"},
    )

    guardian_role.vcard_related_type = "parent"
    guardian_role.save()


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0090_password_perms'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='role',
            name='ical_participation_role',
            field=models.CharField(blank=True, max_length=255, verbose_name='iCal name'),
        ),
        migrations.AddField(
            model_name='role',
            name='vcard_related_type',
            field=models.CharField(blank=True, max_length=255, verbose_name='vCard name'),
        ),
        migrations.RunPython(adapt_guardian_role)
    ]
