[
  {
    "type": "create_table",
    "description": "Create employee_invitations table for self-registration invitations",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'employee_invitations'",
    "sql": "CREATE TABLE `employee_invitations` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `typeNum` varchar(10) NOT NULL, `employeeId` int(10) unsigned NOT NULL, `email` varchar(150) NOT NULL, `token` varchar(64) NOT NULL COMMENT 'Secure random token for invitation link', `invitedBy` int(11) NOT NULL COMMENT 'FK to uf_user.id of inviting admin', `defaultGroups` text DEFAULT NULL COMMENT 'JSON array of group IDs to assign', `expiresAt` timestamp NOT NULL, `usedAt` timestamp NULL DEFAULT NULL, `createdAt` timestamp DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `token` (`token`), KEY `idx_typeNum_employeeId` (`typeNum`, `employeeId`), KEY `idx_email` (`email`), KEY `idx_expiresAt` (`expiresAt`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci"
  }
]
