9f0c064f2a
CI/CD Pipeline / Deploy Staging (push) Has been skipped
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / Build Production Runtime Images (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Frontend Lint (push) Failing after 45h27m46s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 45h27m46s
- Alembic 033: generation_tasks 加 batch_id 列+索引 - Route: count>1 时生成共享 batch_id - Repository: list_by_batch() 批次内查询 - dedup.py: check_batch_duplicate() 批次内查重 - Worker: 生成视频后创建 GeneratedVideo 记录 + 双重查重 - 单元测试: 6 个批次查重测试用例
32 lines
772 B
Python
32 lines
772 B
Python
"""Add batch_id to generation_tasks
|
|
|
|
Revision ID: 033
|
|
Revises: 032
|
|
Create Date: 2026-07-07
|
|
|
|
视频查重功能:为 generation_tasks 表添加 batch_id 字段,
|
|
用于关联同一次批量生成请求中的多个任务。
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "033"
|
|
down_revision = "032"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.add_column(
|
|
"generation_tasks",
|
|
sa.Column("batch_id", sa.String(32), nullable=False, server_default=""),
|
|
)
|
|
op.create_index(op.f("ix_generation_tasks_batch_id"), "generation_tasks", ["batch_id"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f("ix_generation_tasks_batch_id"), table_name="generation_tasks")
|
|
op.drop_column("generation_tasks", "batch_id")
|