# Generated by Django 4.2.23 on 2026-08-08 11:15 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='ContentItem', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('slug', models.SlugField(unique=True)), ('title', models.CharField(max_length=160)), ('kind', models.CharField(choices=[('video', '视频'), ('knowledge', '知识卡片'), ('person', '数学人物')], max_length=16)), ('summary', models.TextField(blank=True)), ('body', models.TextField(blank=True)), ('cover_url', models.URLField(blank=True)), ('media_url', models.URLField(blank=True)), ('topics', models.JSONField(blank=True, default=list)), ('source', models.CharField(blank=True, max_length=300)), ('is_published', models.BooleanField(default=False)), ('published_at', models.DateTimeField(blank=True, null=True)), ], options={ 'ordering': ['-published_at'], }, ), migrations.CreateModel( name='ContentInteraction', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('action', models.CharField(choices=[('view', '浏览'), ('favorite', '收藏'), ('complete', '完成')], max_length=16)), ('created_at', models.DateTimeField(auto_now_add=True)), ('content', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interactions', to='content.contentitem')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.AddConstraint( model_name='contentinteraction', constraint=models.UniqueConstraint(fields=('user', 'content', 'action'), name='unique_content_interaction'), ), ]