From 540143de581c7b33e13894aaac7ef4658d5b9169 Mon Sep 17 00:00:00 2001 From: 18610128193 <10574456+chenweiqiang-123@user.noreply.gitee.com> Date: Tue, 16 Jun 2026 17:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=E5=89=8D?= =?UTF-8?q?=E6=B5=8B=E6=A8=A1=E6=9D=BF=E8=A1=A8=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=B4=A0=E6=9D=90=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=89=8D=E6=B5=8B?= =?UTF-8?q?id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- video-gen-api/alembic/env.py | 1 + ...9ff32ea1bdeb_新增素材前测表和素材表字段.py | 129 ++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 video-gen-api/alembic/versions/9ff32ea1bdeb_新增素材前测表和素材表字段.py diff --git a/video-gen-api/alembic/env.py b/video-gen-api/alembic/env.py index 77028734..c01fe41f 100644 --- a/video-gen-api/alembic/env.py +++ b/video-gen-api/alembic/env.py @@ -38,6 +38,7 @@ from app.models.user_oauth_account import UserOAuthAccount # noqa: F401 from app.models.resources_material import ResourcesMaterial # noqa: F401 from app.models.material_cost import MaterialCost # noqa: F401 from app.models.generated_resource import GeneratedResource # noqa: F401 +from app.models.pre_test_template import PreTestTemplate # noqa: F401 config = context.config diff --git a/video-gen-api/alembic/versions/9ff32ea1bdeb_新增素材前测表和素材表字段.py b/video-gen-api/alembic/versions/9ff32ea1bdeb_新增素材前测表和素材表字段.py new file mode 100644 index 00000000..8a1e5f12 --- /dev/null +++ b/video-gen-api/alembic/versions/9ff32ea1bdeb_新增素材前测表和素材表字段.py @@ -0,0 +1,129 @@ +"""新增素材前测表和素材表字段 + +Revision ID: 9ff32ea1bdeb +Revises: 9216bca75ccf +Create Date: 2026-06-16 17:15:26.964505 +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '9ff32ea1bdeb' +down_revision: Union[str, None] = '9216bca75ccf' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('pre_test_template', sa.Column('note', sa.Text(), nullable=True, comment='模板备注')) + op.alter_column('pre_test_template', 'platform', + existing_type=sa.VARCHAR(length=32), + nullable=True, + existing_comment='投放平台(AD/QIANCHUAN/LOCAL)') + op.alter_column('pre_test_template', 'external_action', + existing_type=sa.VARCHAR(length=64), + nullable=True, + existing_comment='转化目标') + op.alter_column('pre_test_template', 'audience_gender', + existing_type=sa.VARCHAR(length=16), + nullable=True, + existing_comment='性别(ALL/MALE/FEMALE)') + op.alter_column('pre_test_template', 'audience_age', + existing_type=sa.TEXT(), + comment='受众年龄,JSON数组, 格式:[ALL,18-23, 24-30, 31-40, 41-49, 50+]', + existing_comment='受众年龄,JSON数组', + existing_nullable=True) + op.alter_column('pre_test_template', 'audience_network', + existing_type=sa.TEXT(), + comment='网络类型,JSON数组, 格式:[ALL,5G,4G,3G,2G,WIFI]', + existing_comment='网络类型,JSON数组', + existing_nullable=True) + op.alter_column('pre_test_template', 'pricing_type', + existing_type=sa.VARCHAR(length=16), + nullable=True, + existing_comment='出价类型(OCPC/CPA/OCPM)') + op.alter_column('pre_test_template', 'cost_cap', + existing_type=sa.BOOLEAN(), + nullable=True, + existing_comment='是否最优成本出价(仅AD支持)') + op.alter_column('pre_test_template', 'target_cost', + existing_type=sa.BOOLEAN(), + nullable=True, + existing_comment='是否稳定成本出价(仅AD支持)') + op.alter_column('pre_test_template', 'nobid', + existing_type=sa.BOOLEAN(), + nullable=True, + existing_comment='是否最大转化出价(仅AD支持)') + op.alter_column('pre_test_template', 'is_default', + existing_type=sa.BOOLEAN(), + nullable=True, + existing_comment='是否默认模板') + op.drop_column('pre_test_template', 'status') + op.drop_column('pre_test_template', 'description') + op.add_column('resources_material', sa.Column('task_id', sa.String(length=32), nullable=True, comment='前测任务id')) + op.add_column('resources_material', sa.Column('note', sa.Text(), nullable=True, comment='前测失败备注或者其他备注')) + op.add_column('resources_material', sa.Column('status', sa.String(length=16), nullable=True, comment='前测状态(FAILED/PENDING/SUCCESS)')) + op.add_column('resources_material', sa.Column('pre_result', sa.Text(), nullable=True, comment='前测结果,JSON数组对象')) + op.add_column('resources_material', sa.Column('pre_test_template_id', sa.String(length=32), nullable=True, comment='前测模板id')) + op.create_index(op.f('ix_resources_material_task_id'), 'resources_material', ['task_id'], unique=False) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_resources_material_task_id'), table_name='resources_material') + op.drop_column('resources_material', 'pre_test_template_id') + op.drop_column('resources_material', 'pre_result') + op.drop_column('resources_material', 'status') + op.drop_column('resources_material', 'note') + op.drop_column('resources_material', 'task_id') + op.add_column('pre_test_template', sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True, comment='模板描述')) + op.add_column('pre_test_template', sa.Column('status', sa.INTEGER(), autoincrement=False, nullable=False, comment='状态(0=禁用,1=启用)')) + op.alter_column('pre_test_template', 'is_default', + existing_type=sa.BOOLEAN(), + nullable=False, + existing_comment='是否默认模板') + op.alter_column('pre_test_template', 'nobid', + existing_type=sa.BOOLEAN(), + nullable=False, + existing_comment='是否最大转化出价(仅AD支持)') + op.alter_column('pre_test_template', 'target_cost', + existing_type=sa.BOOLEAN(), + nullable=False, + existing_comment='是否稳定成本出价(仅AD支持)') + op.alter_column('pre_test_template', 'cost_cap', + existing_type=sa.BOOLEAN(), + nullable=False, + existing_comment='是否最优成本出价(仅AD支持)') + op.alter_column('pre_test_template', 'pricing_type', + existing_type=sa.VARCHAR(length=16), + nullable=False, + existing_comment='出价类型(OCPC/CPA/OCPM)') + op.alter_column('pre_test_template', 'audience_network', + existing_type=sa.TEXT(), + comment='网络类型,JSON数组', + existing_comment='网络类型,JSON数组, 格式:[ALL,5G,4G,3G,2G,WIFI]', + existing_nullable=True) + op.alter_column('pre_test_template', 'audience_age', + existing_type=sa.TEXT(), + comment='受众年龄,JSON数组', + existing_comment='受众年龄,JSON数组, 格式:[ALL,18-23, 24-30, 31-40, 41-49, 50+]', + existing_nullable=True) + op.alter_column('pre_test_template', 'audience_gender', + existing_type=sa.VARCHAR(length=16), + nullable=False, + existing_comment='性别(ALL/MALE/FEMALE)') + op.alter_column('pre_test_template', 'external_action', + existing_type=sa.VARCHAR(length=64), + nullable=False, + existing_comment='转化目标') + op.alter_column('pre_test_template', 'platform', + existing_type=sa.VARCHAR(length=32), + nullable=False, + existing_comment='投放平台(AD/QIANCHUAN/LOCAL)') + op.drop_column('pre_test_template', 'note') + # ### end Alembic commands ###