-- 检查所有 AiDOP 相关表的 collation 问题
USE aidopdev;

-- 1. 检查 HolidayMaster 和 ResourceOccupancyTime
SELECT 'HolidayMaster 和 ResourceOccupancyTime' AS 检查项;
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, COLLATION_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_SCHEMA = 'aidopdev' 
  AND TABLE_NAME IN ('HolidayMaster', 'ResourceOccupancyTime') 
  AND COLLATION_NAME IS NOT NULL 
ORDER BY TABLE_NAME, COLUMN_NAME;

-- 2. 检查所有包含 Domain/Site 的常用表
SELECT '所有包含 Domain/Site 字段的表' AS 检查项;
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, COLLATION_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_SCHEMA = 'aidopdev' 
  AND COLUMN_NAME IN ('Domain', 'Site')
  AND COLLATION_NAME IS NOT NULL
  AND TABLE_NAME IN (
    'LineMaster', 'QualityLineWorkDetail', 'HolidayMaster', 'ResourceOccupancyTime',
    'AsnShipperMaster', 'AsnShipperDetail', 'ItemMaster', 'CustMaster'
  )
ORDER BY TABLE_NAME, COLUMN_NAME;

-- 3. 检查产品交付相关表（AsnShipperMaster/Detail）
SELECT '产品交付相关表 AsnShipperMaster/Detail' AS 检查项;
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_TYPE, COLLATION_NAME 
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE TABLE_SCHEMA = 'aidopdev' 
  AND TABLE_NAME IN ('AsnShipperMaster', 'AsnShipperDetail')
  AND COLLATION_NAME IS NOT NULL 
ORDER BY TABLE_NAME, COLUMN_NAME;
