# Generated by Django 5.1.6 on 2025-12-26 14:32

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("django_cloudflareimages_toolkit", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Tag",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("slug", models.SlugField(help_text="URL-friendly identifier", max_length=200, unique=True)),
                ("name", models.CharField(max_length=50, unique=True)),
            ],
            options={
                "ordering": ["name"],
            },
        ),
        migrations.CreateModel(
            name="Post",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                ("name", models.CharField(help_text="Name of the object", max_length=200)),
                ("slug", models.SlugField(help_text="URL-friendly identifier", max_length=200, unique=True)),
                ("title", models.CharField(max_length=255)),
                ("content", models.TextField(help_text="Markdown content supported")),
                ("excerpt", models.TextField(blank=True, help_text="Short summary for lists")),
                ("published_at", models.DateTimeField(blank=True, db_index=True, null=True)),
                ("is_published", models.BooleanField(db_index=True, default=False)),
                (
                    "author",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="blog_posts",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "image",
                    models.ForeignKey(
                        blank=True,
                        help_text="Featured image",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="blog_posts",
                        to="django_cloudflareimages_toolkit.cloudflareimage",
                    ),
                ),
                ("tags", models.ManyToManyField(blank=True, related_name="posts", to="blog.tag")),
            ],
            options={
                "ordering": ["-published_at", "-created_at"],
            },
        ),
    ]
