"""Widen system_settings value from VARCHAR(500) to TEXT Revision ID: 004_widen_system_setting_value Revises: 003_render_comments Create Date: 2026-04-17 Rationale --------- SystemSetting.value was VARCHAR(500), which is sufficient for short config values but overflows when the email_ingested_message_ids key accumulates multiple Outlook Message-IDs. A single Outlook Message-ID can be ~100 chars, so even a modest backlog of 6–7 messages exceeds the 500-byte limit, causing: pymysql.err.DataError: (1406, "Data too long for column 'value' at row 1") TEXT (up to 65,535 bytes) is the correct type for any value store that can hold accumulated lists or free-form strings of unbounded length. This mirrors the same fix applied to ticket_history in migration 001. Apply ----- flask db upgrade Rollback -------- flask db downgrade """ from alembic import op import sqlalchemy as sa revision = '004_widen_system_setting_value' down_revision = '003_render_comments' branch_labels = None depends_on = None def upgrade(): with op.batch_alter_table('system_settings', schema=None) as batch_op: batch_op.alter_column( 'value', existing_type=sa.String(length=500), type_=sa.Text(), existing_nullable=False, ) def downgrade(): with op.batch_alter_table('system_settings', schema=None) as batch_op: batch_op.alter_column( 'value', existing_type=sa.Text(), type_=sa.String(length=500), existing_nullable=False, )