# Generated by Django 5.2.12 on 2026-05-01 08:59

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
from django.db.migrations.state import StateApps
from django.db.models import F


def set_updated_at(apps: StateApps, schema_editor):
    SithFile = apps.get_model("core", "SithFile")
    SithFile.objects.update(updated_at=F("date"))


class Migration(migrations.Migration):
    dependencies = [("core", "0049_user_whitelisted_users")]

    operations = [
        migrations.AlterField(
            model_name="sithfile",
            name="moderator",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="moderated_files",
                to=settings.AUTH_USER_MODEL,
                verbose_name="owner",
            ),
        ),
        migrations.AlterField(
            model_name="sithfile",
            name="owner",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="owned_files",
                to=settings.AUTH_USER_MODEL,
                verbose_name="owner",
            ),
        ),
        migrations.AddField(
            model_name="sithfile",
            name="updated_at",
            field=models.DateTimeField(auto_now=True, verbose_name="updated at"),
        ),
        migrations.RunPython(set_updated_at, reverse_code=migrations.RunPython.noop),
    ]
