删除无效迁移

This commit is contained in:
18610128193
2026-06-16 10:39:16 +08:00
parent 9f18e026c6
commit 1967e2497b
@@ -1,142 +0,0 @@
"""修改资源素材表字段
Revision ID: 9216bca75ccf
Revises: acb510c75f6a
Create Date: 2026-06-16 09:39:47.106576
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '9216bca75ccf'
down_revision: Union[str, None] = 'acb510c75f6a'
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.drop_index(op.f('ix_material_cost_advertiser_id'), table_name='material_cost')
op.drop_index(op.f('ix_material_cost_consume_date'), table_name='material_cost')
op.drop_index(op.f('ix_material_cost_deleted_at'), table_name='material_cost')
op.drop_index(op.f('ix_material_cost_material_id'), table_name='material_cost')
op.drop_index(op.f('ix_material_cost_oauth_id'), table_name='material_cost')
op.drop_table('material_cost')
op.drop_index(op.f('ix_resources_material_advertiser_id'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_deleted_at'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_material_id'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_oauth_id'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_resource_type'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_target_id'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_target_table'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_upload_id'), table_name='resources_material')
op.drop_index(op.f('ix_resources_material_user_id'), table_name='resources_material')
op.drop_table('resources_material')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('resources_material',
sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False, comment='主键'),
sa.Column('oauth_id', sa.VARCHAR(length=64), autoincrement=False, nullable=False, comment='授权表user_oauth自增id'),
sa.Column('advertiser_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='广告主id'),
sa.Column('target_table', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='资源表名称'),
sa.Column('target_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='资源表id'),
sa.Column('material_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='素材id'),
sa.Column('upload_id', sa.VARCHAR(length=128), autoincrement=False, nullable=True, comment='上传资源平台id,图片id,视频id'),
sa.Column('resource_type', sa.VARCHAR(length=16), autoincrement=False, nullable=True, comment='资源类型,image或者video'),
sa.Column('user_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='用户登录id'),
sa.Column('created_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
sa.Column('updated_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
sa.Column('deleted_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name=op.f('resources_material_pkey'))
)
op.create_index(op.f('ix_resources_material_user_id'), 'resources_material', ['user_id'], unique=False)
op.create_index(op.f('ix_resources_material_upload_id'), 'resources_material', ['upload_id'], unique=False)
op.create_index(op.f('ix_resources_material_target_table'), 'resources_material', ['target_table'], unique=False)
op.create_index(op.f('ix_resources_material_target_id'), 'resources_material', ['target_id'], unique=False)
op.create_index(op.f('ix_resources_material_resource_type'), 'resources_material', ['resource_type'], unique=False)
op.create_index(op.f('ix_resources_material_oauth_id'), 'resources_material', ['oauth_id'], unique=False)
op.create_index(op.f('ix_resources_material_material_id'), 'resources_material', ['material_id'], unique=False)
op.create_index(op.f('ix_resources_material_deleted_at'), 'resources_material', ['deleted_at'], unique=False)
op.create_index(op.f('ix_resources_material_advertiser_id'), 'resources_material', ['advertiser_id'], unique=False)
op.create_table('material_cost',
sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False, comment='主键'),
sa.Column('oauth_id', sa.VARCHAR(length=64), autoincrement=False, nullable=False, comment='授权表user_oauth自增id'),
sa.Column('advertiser_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='广告主id'),
sa.Column('material_id', sa.VARCHAR(length=64), autoincrement=False, nullable=True, comment='素材id'),
sa.Column('consume_date', sa.DATE(), autoincrement=False, nullable=False, comment='消耗日期'),
sa.Column('stat_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='消耗金额'),
sa.Column('show_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='展示数'),
sa.Column('cpm_platform', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='平均千次展现费用(元)'),
sa.Column('click_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='点击数'),
sa.Column('ctr', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='点击率'),
sa.Column('cpc_platform', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='平均点击单价(元)'),
sa.Column('convert_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='转化数'),
sa.Column('conversion_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='平均转化成本(元)'),
sa.Column('conversion_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='转化率'),
sa.Column('deep_convert_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='深度转化数'),
sa.Column('deep_convert_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='深度转化成本(元)'),
sa.Column('deep_convert_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='深度转化率'),
sa.Column('active', sa.BIGINT(), autoincrement=False, nullable=True, comment='激活数'),
sa.Column('active_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='激活成本(元)'),
sa.Column('active_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='激活率'),
sa.Column('active_register', sa.BIGINT(), autoincrement=False, nullable=True, comment='注册数'),
sa.Column('active_register_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='注册成本(元)'),
sa.Column('active_register_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='注册率'),
sa.Column('created_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
sa.Column('updated_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
sa.Column('deleted_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
sa.Column('attribution_next_day_open_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='次留数'),
sa.Column('attribution_next_day_open_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='次留成本'),
sa.Column('attribution_next_day_open_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='次留率'),
sa.Column('active_pay', sa.BIGINT(), autoincrement=False, nullable=True, comment='首次付费数'),
sa.Column('active_pay_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='首次付费成本(元)'),
sa.Column('active_pay_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='首次付费率'),
sa.Column('phone', sa.BIGINT(), autoincrement=False, nullable=True, comment='点击电话按钮'),
sa.Column('form', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户在门店落地页多线沟通提交表单的次数'),
sa.Column('download_start', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户点击下载开始的次数'),
sa.Column('form_submit', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户查看附加创意后,提交表单的次数'),
sa.Column('button', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户点击按钮button的次数'),
sa.Column('view', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户在关键页面的浏览次数'),
sa.Column('message', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户点击短信咨询的次数'),
sa.Column('consult', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户点击在线咨询按钮的次数'),
sa.Column('consult_effective', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户在门店落地页多线沟通的在线咨询中有效咨询的次数'),
sa.Column('shopping', sa.BIGINT(), autoincrement=False, nullable=True, comment='用户购买商品的次数'),
sa.Column('customer_effective', sa.BIGINT(), autoincrement=False, nullable=True, comment='有效获客'),
sa.Column('attribution_game_in_app_ltv_1day', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='当日付费金额'),
sa.Column('attribution_game_in_app_roi_1day', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='当日付费ROI'),
sa.Column('loan_completion', sa.BIGINT(), autoincrement=False, nullable=True, comment='完件数互联网金融-贷款行业中,用户成功提交贷款额度申请的行为'),
sa.Column('loan_completion_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='完件成本(元)'),
sa.Column('loan_completion_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='完件率'),
sa.Column('loan_credit', sa.BIGINT(), autoincrement=False, nullable=True, comment='互联网金融-贷款行业中,用户提交贷款额度申请后,客户审批通过,给予用户可贷款的额度'),
sa.Column('loan_credit_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='授信成本(元)'),
sa.Column('loan_credit_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='授信率'),
sa.Column('in_app_order_gmv', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='当您使用"in_app_order"事件回传订单金额时,对应的GMV金额,引流电商订单GMV'),
sa.Column('in_app_order_roi', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='引流电商订单ROI'),
sa.Column('in_app_pay_gmv', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='引流电商支付GMV'),
sa.Column('in_app_pay_roi', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='引流电商支付ROI'),
sa.Column('total_play', sa.BIGINT(), autoincrement=False, nullable=True, comment='播放量播放时间大于0S的数量,在某些蜂窝网络环境下,需要您手动点击开始才会开始播放,因此有时播放数小于展示数。'),
sa.Column('valid_play', sa.BIGINT(), autoincrement=False, nullable=True, comment='有效播放数'),
sa.Column('valid_play_cost', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='有效播放成本(元)'),
sa.Column('valid_play_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='有效播放率'),
sa.Column('valid_play_of_mille', sa.BIGINT(), autoincrement=False, nullable=True, comment='千次有效播放数'),
sa.Column('valid_play_cost_of_mille', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='千次有效播放成本(元)'),
sa.Column('average_play_time_per_play', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='平均单次播放时长'),
sa.Column('play_over_rate', sa.DOUBLE_PRECISION(precision=53), autoincrement=False, nullable=True, comment='完播率'),
sa.Column('dy_like', sa.BIGINT(), autoincrement=False, nullable=True, comment='点赞数'),
sa.Column('dy_comment', sa.BIGINT(), autoincrement=False, nullable=True, comment='评论量'),
sa.Column('dy_share', sa.BIGINT(), autoincrement=False, nullable=True, comment='分享量'),
sa.Column('report_cnt', sa.BIGINT(), autoincrement=False, nullable=True, comment='举报数'),
sa.PrimaryKeyConstraint('id', name=op.f('material_cost_pkey'))
)
op.create_index(op.f('ix_material_cost_oauth_id'), 'material_cost', ['oauth_id'], unique=False)
op.create_index(op.f('ix_material_cost_material_id'), 'material_cost', ['material_id'], unique=False)
op.create_index(op.f('ix_material_cost_deleted_at'), 'material_cost', ['deleted_at'], unique=False)
op.create_index(op.f('ix_material_cost_consume_date'), 'material_cost', ['consume_date'], unique=False)
op.create_index(op.f('ix_material_cost_advertiser_id'), 'material_cost', ['advertiser_id'], unique=False)
# ### end Alembic commands ###