# Generated by Django 2.2.8 on 2021-04-04 13:48

import uuid

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
    ]

    operations = [
        migrations.CreateModel(
            name="PermissionTemplate",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("owner_grantee_type", models.CharField(max_length=255)),
                ("owner_grantee_value", models.CharField(max_length=255)),
                ("target_grantee_type", models.CharField(max_length=255)),
                ("target_grantee_value", models.CharField(max_length=255)),
                ("target_operation", models.CharField(blank=True, max_length=10)),
                (
                    "content_type",
                    models.ForeignKey(
                        help_text="if empty, will apply for every content type",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="contenttypes.ContentType",
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Permission",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("grantee_type", models.CharField(max_length=255)),
                ("grantee_value", models.CharField(max_length=255)),
                ("object_pk", models.UUIDField(editable=False)),
                ("operation", models.CharField(blank=True, max_length=10)),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="permissions",
                        to="contenttypes.ContentType",
                    ),
                ),
            ],
        ),
        migrations.AddIndex(
            model_name="permissiontemplate",
            index=models.Index(
                fields=["content_type"], name="django_obje_content_07c1a3_idx"
            ),
        ),
        migrations.AddIndex(
            model_name="permission",
            index=models.Index(
                fields=["content_type", "object_pk"],
                name="django_obje_content_a788e2_idx",
            ),
        ),
    ]
