[
  {
    "type": "create_table",
    "description": "Create staff_chat_channel_members table for manual membership overrides (ADR-3 hybrid approach)",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'staff_chat_channel_members'",
    "sql": "CREATE TABLE `staff_chat_channel_members` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `channelId` int(10) unsigned NOT NULL,\n  `employeeId` int(10) unsigned NOT NULL,\n  `membershipType` enum('auto','manual') NOT NULL DEFAULT 'auto',\n  `isMuted` tinyint(1) NOT NULL DEFAULT 0,\n  `joinedAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `mutedAt` timestamp NULL DEFAULT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_channel_employee` (`channelId`, `employeeId`),\n  KEY `idx_employeeId` (`employeeId`),\n  CONSTRAINT `fk_staff_chat_member_channel` FOREIGN KEY (`channelId`) REFERENCES `staff_chat_channels` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Staff Chat channel membership overrides and mute settings'"
  }
]
