# Generated migration for blogs app

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Blog',
            fields=[
                ('slug', models.SlugField(db_index=True, max_length=255, primary_key=True, serialize=False, unique=True)),
                ('title', models.CharField(max_length=255, unique=True)),
                ('content', models.TextField()),
                ('thumbnail_image', models.ImageField(help_text='Thumbnail image for blog list', upload_to='blog_thumbnails/')),
                ('featured_image', models.ImageField(help_text='Featured image for blog post', upload_to='blog_images/')),
                ('meta_title', models.CharField(help_text='SEO meta title (60 characters recommended)', max_length=60)),
                ('meta_description', models.CharField(help_text='SEO meta description (160 characters recommended)', max_length=160)),
                ('tags', models.CharField(help_text='Comma-separated tags for SEO', max_length=255)),
                ('og_title', models.CharField(blank=True, help_text='Open Graph title', max_length=255)),
                ('og_description', models.CharField(blank=True, help_text='Open Graph description', max_length=160)),
                ('og_image', models.ImageField(blank=True, help_text='Open Graph image', null=True, upload_to='blog_og_images/')),
                ('is_featured', models.BooleanField(default=False, help_text='Mark as featured blog')),
                ('is_published', models.BooleanField(default=False, help_text='Publish this blog')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('published_at', models.DateTimeField(blank=True, help_text='Date when blog was published', null=True)),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='blogs', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-published_at', '-created_at'],
            },
        ),
        migrations.AddIndex(
            model_name='blog',
            index=models.Index(fields=['is_published', '-published_at'], name='blogs_blog_is_published_published_idx'),
        ),
        migrations.AddIndex(
            model_name='blog',
            index=models.Index(fields=['is_featured'], name='blogs_blog_is_featured_idx'),
        ),
    ]
