# Generated by Django 3.1.7 on 2023-09-25 08:26

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

import thunderstore.storage.models.blob
import thunderstore.utils.makemigrations


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="DataBlob",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("is_deleted", models.BooleanField(default=False)),
                (
                    "data",
                    models.FileField(
                        blank=True,
                        editable=False,
                        null=True,
                        storage=thunderstore.utils.makemigrations.StubStorage(),
                        upload_to=thunderstore.storage.models.blob.get_object_file_path,
                    ),
                ),
                ("data_size", models.BigIntegerField()),
                (
                    "checksum_sha256",
                    models.CharField(
                        db_index=True, editable=False, max_length=512, unique=True
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.CreateModel(
            name="DataBlobReference",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("datetime_created", models.DateTimeField(auto_now_add=True)),
                ("datetime_updated", models.DateTimeField(auto_now=True)),
                ("name", models.TextField(blank=True, null=True)),
                ("content_type", models.TextField(blank=True, null=True)),
                ("content_encoding", models.TextField(blank=True, null=True)),
                (
                    "blob",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="references",
                        to="storage.datablob",
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
