[
  {
    "type": "create_table",
    "description": "Create userStoreAssignments table for multi-store user access",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'userStoreAssignments'",
    "sql": "CREATE TABLE `userStoreAssignments` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `userId` int(11) NOT NULL COMMENT 'FK to uf_user.id',\n  `typeNum` varchar(10) NOT NULL COMMENT 'Store identifier (e.g., ou00, pa00)',\n  `clockPin` varchar(10) DEFAULT NULL COMMENT 'Time clock PIN for this store',\n  `drsEmployeeId` varchar(50) DEFAULT NULL COMMENT 'DRS/POS employee ID',\n  `role` tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Role level at this store',\n  `isActive` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Assignment active status',\n  `assignedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'When user was assigned to store',\n  `deactivatedAt` timestamp NULL DEFAULT NULL COMMENT 'When assignment was deactivated',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_user_store` (`userId`, `typeNum`),\n  KEY `idx_typeNum` (`typeNum`),\n  KEY `idx_isActive` (`isActive`),\n  KEY `idx_userId` (`userId`),\n  CONSTRAINT `fk_userStoreAssignments_user` FOREIGN KEY (`userId`) REFERENCES `uf_user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='User to store assignment junction table'"
  }
]
