# Generated by Django 2.2.6 on 2019-11-21 20:51

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import utils.uploads
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        ("actor", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Attachment",
            fields=[
                (
                    "created",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="The date and time when this object was created.",
                    ),
                ),
                (
                    "updated",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        help_text="The date and time when this object was last updated.",
                    ),
                ),
                (
                    "uuid",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "object_id",
                    models.CharField(
                        help_text="The PK/UUID of the object this Event relates to.",
                        max_length=36,
                    ),
                ),
                (
                    "attachment",
                    models.FileField(
                        help_text="The file",
                        upload_to=utils.uploads.get_attachment_path,
                    ),
                ),
                (
                    "mimetype",
                    models.CharField(
                        help_text="The mimetype of this file as detected by python-magic on upload.",
                        max_length=255,
                    ),
                ),
                (
                    "size",
                    models.IntegerField(help_text="The size in bytes of this file"),
                ),
                (
                    "description",
                    models.CharField(
                        blank=True,
                        help_text="The description for this attachment.",
                        max_length=255,
                    ),
                ),
                (
                    "actor",
                    models.ForeignKey(
                        help_text="The Actor who uploaded this Attachment blabla.",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="attachments",
                        to="actor.Actor",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        help_text="The Django content_type of the model for the object this Event relates to.",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="attachments",
                        to="contenttypes.ContentType",
                    ),
                ),
            ],
            options={
                "ordering": ["-created"],
                "get_latest_by": "created",
                "abstract": False,
            },
        )
    ]
