7b62c2f8b4
## H5 底部导航修复 (Bug #10) - 精简 App.vue,移除重复 tabbar,仅保留全局样式 - uni-page 设置 height: calc(100% - 50px) + overflow-y: auto - 内容区域精确停在底部导航上方,独立滚动不再叠加 - 恢复 custom-tab-bar 组件 ## 项目进度文档 - PROGRESS.md 更新至 10 个 Bug 修复 - 新增 H5 底部导航修复记录 - 新增历史变更条目
67 lines
3.3 KiB
Python
67 lines
3.3 KiB
Python
"""add followup_strategies and followup_logs tables
|
|
|
|
Revision ID: 005
|
|
Revises: 004
|
|
Create Date: 2026-05-10
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
revision: str = '005'
|
|
down_revision: Union[str, None] = '004'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table('followup_strategies',
|
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('name', sa.String(length=255), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=True),
|
|
sa.Column('trigger_condition', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
|
sa.Column('channel', sa.String(length=50), nullable=True),
|
|
sa.Column('ai_prompt_template', sa.Text(), nullable=True),
|
|
sa.Column('priority', sa.Integer(), nullable=True),
|
|
sa.Column('is_active', sa.Boolean(), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
)
|
|
|
|
op.create_table('followup_logs',
|
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('customer_id', postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column('strategy_id', postgresql.UUID(as_uuid=True), nullable=True),
|
|
sa.Column('status', sa.String(length=50), nullable=True),
|
|
sa.Column('channel', sa.String(length=50), nullable=True),
|
|
sa.Column('content', sa.Text(), nullable=True),
|
|
sa.Column('ai_generated_content', sa.Text(), nullable=True),
|
|
sa.Column('user_edited_content', sa.Text(), nullable=True),
|
|
sa.Column('health_score_at_time', sa.Integer(), nullable=True),
|
|
sa.Column('silence_days_at_time', sa.Integer(), nullable=True),
|
|
sa.Column('sent_at', sa.DateTime(), nullable=True),
|
|
sa.Column('replied_at', sa.DateTime(), nullable=True),
|
|
sa.Column('response_status', sa.String(length=50), nullable=True),
|
|
sa.Column('metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
|
sa.Column('created_at', sa.DateTime(), nullable=True),
|
|
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
)
|
|
op.create_index(op.f('ix_followup_logs_user_id'), 'followup_logs', ['user_id'], unique=False)
|
|
op.create_index(op.f('ix_followup_logs_customer_id'), 'followup_logs', ['customer_id'], unique=False)
|
|
op.create_foreign_key('fk_followup_logs_customer', 'followup_logs', 'customers', ['customer_id'], ['id'])
|
|
op.create_foreign_key('fk_followup_logs_strategy', 'followup_logs', 'followup_strategies', ['strategy_id'], ['id'])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_constraint('fk_followup_logs_strategy', 'followup_logs', type_='foreignkey')
|
|
op.drop_constraint('fk_followup_logs_customer', 'followup_logs', type_='foreignkey')
|
|
op.drop_index(op.f('ix_followup_logs_customer_id'), table_name='followup_logs')
|
|
op.drop_index(op.f('ix_followup_logs_user_id'), table_name='followup_logs')
|
|
op.drop_table('followup_logs')
|
|
op.drop_table('followup_strategies')
|