a6f55a00b8
Co-authored-by: 陈世睿 <2839904623@qq.com> Reviewed-on: #65 Co-authored-by: chenshirui <chenshirui@wonderable.ai> Co-committed-by: chenshirui <chenshirui@wonderable.ai>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""device.kill_alert_pending (无障碍掉线「后置检测」待提醒标记)
|
|
|
|
Revision ID: device_kill_alert_pending
|
|
Revises: device_liveness_table
|
|
Create Date: 2026-06-19
|
|
|
|
后置检测 pull 版(spec/accessibility-liveness-pull-prompt.md):worker 检出心跳掉线即置此标记,
|
|
客户端下次进 App 拉取到 → 弹「开启自启动」引导,交互后 ack 清回。与 liveness_state 解耦,故单列。
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'device_kill_alert_pending'
|
|
down_revision: Union[str, Sequence[str], None] = 'device_liveness_table'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# server_default=sa.false() 跨方言: SQLite 渲染 0 / PG 渲染 false(别用 sa.text("0"),PG 布尔严格会报错),
|
|
# 给存量行回填 False。
|
|
with op.batch_alter_table('device_liveness', schema=None) as batch_op:
|
|
batch_op.add_column(
|
|
sa.Column(
|
|
'kill_alert_pending',
|
|
sa.Boolean(),
|
|
nullable=False,
|
|
server_default=sa.false(),
|
|
)
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table('device_liveness', schema=None) as batch_op:
|
|
batch_op.drop_column('kill_alert_pending')
|