# 性能优化：为常用查询字段添加数据库索引
# Generated manually for performance optimization

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('blog', '0001_initial'),
    ]

    operations = [
        # 为 Article 模型添加索引
        migrations.AddIndex(
            model_name='article',
            index=models.Index(fields=['status', 'type'], name='article_status_type_idx'),
        ),
        migrations.AddIndex(
            model_name='article',
            index=models.Index(fields=['status', 'pub_time'], name='article_status_pubtime_idx'),
        ),
        migrations.AddIndex(
            model_name='article',
            index=models.Index(fields=['-pub_time'], name='article_pubtime_desc_idx'),
        ),
        migrations.AddIndex(
            model_name='article',
            index=models.Index(fields=['article_order', '-pub_time'], name='article_order_pubtime_idx'),
        ),

        # 为 Category 添加 slug 索引（用于URL查找）
        migrations.AlterField(
            model_name='category',
            name='slug',
            field=models.SlugField(default='no-slug', max_length=60, blank=True, db_index=True),
        ),

        # 为 Tag 添加 slug 索引（用于URL查找）
        migrations.AlterField(
            model_name='tag',
            name='slug',
            field=models.SlugField(default='no-slug', max_length=60, blank=True, db_index=True),
        ),
    ]
