[
  {
    "type": "add_column",
    "description": "Add updated_at column to event_integrations for integration updates/disable flows",
    "database": "{{store}}",
    "check_query": "SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations') OR EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations' AND COLUMN_NAME = 'updated_at')",
    "sql": "ALTER TABLE `event_integrations` ADD COLUMN `updated_at` TIMESTAMP NULL ON UPDATE CURRENT_TIMESTAMP AFTER `created_at`"
  },
  {
    "type": "alter_table",
    "description": "Expand event_integrations.integrationType enum to include floorplan integrations",
    "database": "{{store}}",
    "check_query": "SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations') OR EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations' AND COLUMN_NAME = 'integrationType' AND COLUMN_TYPE LIKE '%floorplan%')",
    "sql": "ALTER TABLE `event_integrations` MODIFY COLUMN `integrationType` ENUM('backstock', 'sms_blast', 'sms_trigger', 'signage', 'comeback_cash', 'task', 'note', 'floorplan') NOT NULL"
  },
  {
    "type": "alter_table",
    "description": "Expand event_integrations.status enum to include disabled state",
    "database": "{{store}}",
    "check_query": "SELECT 1 WHERE NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations') OR EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'event_integrations' AND COLUMN_NAME = 'status' AND COLUMN_TYPE LIKE '%disabled%')",
    "sql": "ALTER TABLE `event_integrations` MODIFY COLUMN `status` ENUM('pending', 'active', 'completed', 'failed', 'disabled') DEFAULT 'pending'"
  }
]
