1、增加调用 AI 视频生成能力和虚拟素材库管理的对外api
2、增加后台apikkey管理 3、增加apikey单独的模型定价 4、增加apikey调用情况 5、完善所有数据的注释增加
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""enhance api_usage_logs with detailed consumption fields
|
||||
|
||||
Revision ID: e6f7g8h9i0j1
|
||||
Revises: d5e6f7g8h9i0
|
||||
Create Date: 2026-07-29 17:00:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'e6f7g8h9i0j1'
|
||||
down_revision: Union[str, None] = 'd5e6f7g8h9i0'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# 添加新字段
|
||||
op.add_column('api_usage_logs', sa.Column('price_action', sa.String(16), nullable=False, server_default='deduct', comment='deduct=扣除, refund=退回'))
|
||||
op.add_column('api_usage_logs', sa.Column('resolution', sa.String(16), nullable=True, comment="分辨率: 480p/720p/1080p/2K/4K"))
|
||||
op.add_column('api_usage_logs', sa.Column('duration', sa.Integer(), nullable=True, comment="视频时长(秒)"))
|
||||
op.add_column('api_usage_logs', sa.Column('refund_amount', sa.Float(), nullable=False, server_default='0.0', comment='退回金额'))
|
||||
op.add_column('api_usage_logs', sa.Column('quota_before', sa.Float(), nullable=True, comment='操作前配额余额'))
|
||||
op.add_column('api_usage_logs', sa.Column('quota_after', sa.Float(), nullable=True, comment='操作后配额余额'))
|
||||
op.add_column('api_usage_logs', sa.Column('price_detail_json', sa.Text(), nullable=True, comment='价格计算明细JSON'))
|
||||
|
||||
# 添加索引
|
||||
op.create_index('idx_api_usage_logs_action', 'api_usage_logs', ['price_action'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index('idx_api_usage_logs_action', table_name='api_usage_logs')
|
||||
op.drop_column('api_usage_logs', 'price_detail_json')
|
||||
op.drop_column('api_usage_logs', 'quota_after')
|
||||
op.drop_column('api_usage_logs', 'quota_before')
|
||||
op.drop_column('api_usage_logs', 'refund_amount')
|
||||
op.drop_column('api_usage_logs', 'duration')
|
||||
op.drop_column('api_usage_logs', 'resolution')
|
||||
op.drop_column('api_usage_logs', 'price_action')
|
||||
Reference in New Issue
Block a user