"""Add applications monitorable fields Backs the "monitorable" checkbox on the Application form: an app that the endpoint agent can watch as a process monitor. A monitor needs something to look for (the Windows image name) and something to start when it is missing (the launch path), so the API refuses to save ismonitorable without both. The two text columns stay NULLABLE rather than carrying a constraint, because every application row that existed before this migration has neither value and must remain valid. The pairing rule is enforced in shopdb/core/api/applications.py where it can return a useful message, not in the schema where it would only produce an IntegrityError. Revision ID: 7d44_app_monitorable Revises: 7d43_userpermissions Create Date: 2026-09-08 """ from alembic import op import sqlalchemy as sa revision = '7d44_app_monitorable' down_revision = '7d43_userpermissions' branch_labels = None depends_on = None def upgrade(): op.add_column('applications', sa.Column( 'ismonitorable', sa.Boolean(), nullable=True, server_default=sa.false(), comment='Can be watched by the endpoint agent (needs launch path + process name)')) op.add_column('applications', sa.Column( 'monitorlaunchpath', sa.String(length=512), nullable=True)) op.add_column('applications', sa.Column( 'monitorprocessname', sa.String(length=255), nullable=True)) def downgrade(): op.drop_column('applications', 'monitorprocessname') op.drop_column('applications', 'monitorlaunchpath') op.drop_column('applications', 'ismonitorable')