A8 多套交付包(packaging_task.py): - 修复交付包只打第1条混乱note的bug,按ImageCandidate.strategy分A/B/C组 - 每组生独立note_0N夹(6图+文案.txt),同seq留最新去重,老数据兼容 - task74端到端验:3套各6图,独立agent7项交叉验证全过 M4 归档(tasks.py/exports.py/前端): - list_tasks加date_from/date_to/product_id筛选+product_name批量填(防N+1) - 新增exports.py:产品JSON导出+标杆CSV导出(UTF-8 BOM) - 前端HistoryFilters日期/产品筛选+产品列+打回原因红banner - response.py加raise_param_error;独立agent验A1/A2/A9通过 R5 产品多图(product_images.py/020迁移/前端): - product_images表+5端点(上传/列/改场景/设主图/删图) - 生图按ROLE_SCENE_PREFERENCE选对应场景图,回落primary - 前端ProductImageManager多图画廊 R6 账号config拆页(settings/): - 配置页按角色拆/settings(运营+组长+admin)+/config(仅admin) - Key只显末4位不显余额(守红线) 核销表对齐真实代码状态:D1改稿框/M7裂变/E12评图分纠偏为已完成(曾漏回写) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
"""create product_images table
|
||
|
||
Revision ID: 020
|
||
Revises: 019
|
||
Create Date: 2026-06-18
|
||
|
||
R5 产品多图:一产品多张参考图,每张标 scene 场景类型(primary/scene/
|
||
texture/ingredient/model),生图按分镜 role 选用对应图,取不到回落主图。
|
||
product.image_path 仍保留当主图(向后兼容,零破坏)。
|
||
"""
|
||
from alembic import op
|
||
import sqlalchemy as sa
|
||
|
||
revision = "020"
|
||
down_revision = "019"
|
||
branch_labels = None
|
||
depends_on = None
|
||
|
||
_SCENES = ("primary", "scene", "texture", "ingredient", "model")
|
||
|
||
|
||
def upgrade():
|
||
op.create_table(
|
||
"product_images",
|
||
sa.Column("id", sa.BigInteger, primary_key=True, autoincrement=True),
|
||
sa.Column(
|
||
"product_id", sa.BigInteger,
|
||
sa.ForeignKey("products.id", ondelete="CASCADE"),
|
||
nullable=False,
|
||
),
|
||
sa.Column("path", sa.String(512), nullable=False, comment="绝对路径,worker直接open"),
|
||
sa.Column(
|
||
"scene", sa.Enum(*_SCENES, name="productimagescene"),
|
||
nullable=False, server_default="primary",
|
||
comment="场景类型:白底主图/使用场景/质地/成分/上脸",
|
||
),
|
||
sa.Column("is_primary", sa.Boolean, nullable=False, server_default=sa.false(),
|
||
comment="主图(同步 product.image_path)"),
|
||
sa.Column("sort_order", sa.Integer, nullable=False, server_default="0"),
|
||
sa.Column("created_at", sa.DateTime, server_default=sa.func.now(), nullable=False),
|
||
)
|
||
op.create_index("idx_product_images_product_id", "product_images", ["product_id"])
|
||
|
||
|
||
def downgrade():
|
||
op.drop_index("idx_product_images_product_id", table_name="product_images")
|
||
op.drop_table("product_images")
|