# Generated by Django 4.2 on 2026-02-09 06:31

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="Track",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=200, verbose_name="标题")),
                (
                    "lyrics",
                    models.TextField(blank=True, default="", verbose_name="歌词"),
                ),
                (
                    "audio_url",
                    models.URLField(
                        blank=True, default="", max_length=500, verbose_name="音频URL"
                    ),
                ),
                (
                    "cover_url",
                    models.URLField(
                        blank=True, default="", max_length=500, verbose_name="封面URL"
                    ),
                ),
                (
                    "mood",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("happy", "开心"),
                            ("sad", "悲伤"),
                            ("calm", "平静"),
                            ("energetic", "活力"),
                            ("romantic", "浪漫"),
                        ],
                        max_length=20,
                        null=True,
                        verbose_name="情绪标签",
                    ),
                ),
                ("duration", models.IntegerField(default=0, verbose_name="时长(秒)")),
                (
                    "prompt",
                    models.TextField(blank=True, default="", verbose_name="生成提示词"),
                ),
                (
                    "is_favorite",
                    models.BooleanField(default=False, verbose_name="是否收藏"),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(auto_now=True, verbose_name="更新时间"),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="tracks",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="用户",
                    ),
                ),
            ],
            options={
                "verbose_name": "音乐曲目",
                "verbose_name_plural": "音乐曲目",
                "db_table": "track",
                "ordering": ["-created_at"],
            },
        ),
        migrations.AddIndex(
            model_name="track",
            index=models.Index(
                fields=["user", "is_favorite"], name="track_user_id_c612cb_idx"
            ),
        ),
    ]
