# Generated by Django 4.2.1 on 2023-05-07 17:15

import uuid

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="GemLogEntry",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                        unique=True,
                    ),
                ),
                (
                    "object_id",
                    models.CharField(db_index=True, max_length=255, verbose_name="object id"),
                ),
                (
                    "action",
                    models.PositiveSmallIntegerField(
                        choices=[(0, "create"), (1, "update"), (2, "delete")],
                        db_index=True,
                        verbose_name="action",
                    ),
                ),
                ("changes", models.JSONField(verbose_name="Model changed fields")),
                (
                    "timestamp",
                    models.DateTimeField(
                        auto_now_add=True, db_index=True, verbose_name="timestamp"
                    ),
                ),
                (
                    "actor",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="actor",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="+",
                        to="contenttypes.contenttype",
                        verbose_name="content type",
                    ),
                ),
            ],
            options={
                "verbose_name": "gem log entry",
                "verbose_name_plural": "gem log entries",
                "ordering": ["-timestamp"],
                "get_latest_by": "timestamp",
            },
        ),
    ]
