# Generated by Django 5.2.7 on 2026-01-07 02:21

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('asset', '0002_create_search_views'),
        ('scan', '0001_initial'),
        ('targets', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Screenshot',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('url', models.TextField(help_text='截图对应的 URL')),
                ('image', models.BinaryField(help_text='截图 WebP 二进制数据（压缩后）')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='更新时间')),
                ('target', models.ForeignKey(help_text='所属目标', on_delete=django.db.models.deletion.CASCADE, related_name='screenshots', to='targets.target')),
            ],
            options={
                'verbose_name': '截图',
                'verbose_name_plural': '截图',
                'db_table': 'screenshot',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['target'], name='screenshot_target__2f01f6_idx'), models.Index(fields=['-created_at'], name='screenshot_created_c0ad4b_idx')],
                'constraints': [models.UniqueConstraint(fields=('target', 'url'), name='unique_screenshot_per_target')],
            },
        ),
        migrations.CreateModel(
            name='ScreenshotSnapshot',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('url', models.TextField(help_text='截图对应的 URL')),
                ('image', models.BinaryField(help_text='截图 WebP 二进制数据（压缩后）')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='创建时间')),
                ('scan', models.ForeignKey(help_text='所属的扫描任务', on_delete=django.db.models.deletion.CASCADE, related_name='screenshot_snapshots', to='scan.scan')),
            ],
            options={
                'verbose_name': '截图快照',
                'verbose_name_plural': '截图快照',
                'db_table': 'screenshot_snapshot',
                'ordering': ['-created_at'],
                'indexes': [models.Index(fields=['scan'], name='screenshot__scan_id_fb8c4d_idx'), models.Index(fields=['-created_at'], name='screenshot__created_804117_idx')],
                'constraints': [models.UniqueConstraint(fields=('scan', 'url'), name='unique_screenshot_per_scan_snapshot')],
            },
        ),
    ]
