[
  {
    "type": "create_table",
    "description": "Create event_integrations table for linking events to other systems",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'event_integrations'",
    "sql": "CREATE TABLE `event_integrations` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `eventId` INT UNSIGNED NOT NULL,\n  `integrationType` ENUM('backstock', 'sms_blast', 'sms_trigger', 'signage', 'comeback_cash', 'task', 'note') NOT NULL,\n  `foreignId` INT UNSIGNED NOT NULL COMMENT 'ID in the target system',\n  `config` JSON NULL COMMENT 'Integration-specific configuration',\n  `status` ENUM('pending', 'active', 'completed', 'failed') DEFAULT 'pending',\n  `relativeDays` INT NULL COMMENT 'Days relative to event start (negative = before)',\n  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  INDEX `idx_event` (`eventId`),\n  INDEX `idx_type` (`integrationType`),\n  UNIQUE KEY `uk_event_integration` (`eventId`, `integrationType`, `foreignId`),\n  CONSTRAINT `fk_event` FOREIGN KEY (`eventId`) REFERENCES `events`(`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Event integration links to other systems'"
  }
]
