# 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 import uuid class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='FormulaDocument', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('title', models.CharField(max_length=120)), ('source', models.TextField(blank=True)), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='formulas', to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ['-updated_at'], }, ), migrations.CreateModel( name='LatexCourse', 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=120)), ('description', models.TextField(blank=True)), ('order', models.PositiveIntegerField(default=0)), ('is_published', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='LatexLesson', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('slug', models.SlugField()), ('title', models.CharField(max_length=120)), ('content', models.TextField()), ('example_source', models.TextField(blank=True)), ('order', models.PositiveIntegerField(default=0)), ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lessons', to='latex_lab.latexcourse')), ], options={ 'ordering': ['order'], }, ), migrations.CreateModel( name='LatexExercise', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('prompt', models.TextField()), ('expected_source', models.TextField()), ('explanation', models.TextField(blank=True)), ('order', models.PositiveIntegerField(default=0)), ('lesson', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='latex_lab.latexlesson')), ], ), migrations.CreateModel( name='LatexAttempt', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('submitted_source', models.TextField()), ('is_correct', models.BooleanField()), ('created_at', models.DateTimeField(auto_now_add=True)), ('exercise', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='latex_lab.latexexercise')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='latex_attempts', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='HandwritingRecognitionJob', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('status', models.CharField(choices=[('pending', '等待'), ('complete', '完成'), ('failed', '失败')], default='pending', max_length=16)), ('result', models.JSONField(blank=True, default=dict)), ('created_at', models.DateTimeField(auto_now_add=True)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='FormulaRevision', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('source', models.TextField()), ('created_at', models.DateTimeField(auto_now_add=True)), ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='latex_lab.formuladocument')), ], ), migrations.AddConstraint( model_name='latexlesson', constraint=models.UniqueConstraint(fields=('course', 'slug'), name='unique_course_lesson'), ), ]