b2c20ec43d
- 新增微信告警服务(wechat_service)和告警任务(alert_tasks) - 新增 WebSocket 实时推送端点 - 新增监控管理模块(monitor) - 增强统计仪表板:趋势图、区域分布、光功率历史 - 设备管理:添加坐标信息、标签系统、复合索引优化 - 前端:重构Dashboard/Charts页面,新增业务组件 - 新增5个数据库迁移(坐标、复合索引、标签、光功率历史、显示名) - 更新部署配置和脚本 - 新增测试框架基础结构
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""add optical_power_history table
|
|
|
|
Revision ID: l1m2n3o4p5q6
|
|
Revises: k0l1m2n3o4p5
|
|
Create Date: 2026-06-03 11:00:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision: str = 'l1m2n3o4p5q6'
|
|
down_revision: Union[str, None] = 'k0l1m2n3o4p5'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table('optical_power_history',
|
|
sa.Column('id', sa.BigInteger(), nullable=False),
|
|
sa.Column('onu_device_id', sa.BigInteger(), sa.ForeignKey('onu_devices.id'), nullable=False),
|
|
sa.Column('power_in', sa.String(20), nullable=True),
|
|
sa.Column('power_out', sa.String(20), nullable=True),
|
|
sa.Column('recorded_at', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_index('ix_optical_power_history_id', 'optical_power_history', ['id'])
|
|
op.create_index('ix_optical_power_history_onu_device_id', 'optical_power_history', ['onu_device_id'])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index('ix_optical_power_history_onu_device_id', table_name='optical_power_history')
|
|
op.drop_index('ix_optical_power_history_id', table_name='optical_power_history')
|
|
op.drop_table('optical_power_history')
|