-- ========================================================================
-- HolidayMaster 主数据表添加 tenant_id 字段
-- 注意：此表为主数据表，Service 层已实现租户过滤，但数据库表需手动添加字段
-- ========================================================================

USE aidopdev;

-- 添加 tenant_id 字段
ALTER TABLE HolidayMaster
ADD COLUMN IF NOT EXISTS tenant_id BIGINT NULL COMMENT '租户ID（多租户隔离）';

-- 创建索引
CREATE INDEX IF NOT EXISTS idx_tenant_id ON HolidayMaster(tenant_id);

-- 验证
SELECT 
    TABLE_NAME AS 表名,
    COLUMN_NAME AS 字段名,
    COLUMN_TYPE AS 字段类型,
    IS_NULLABLE AS 是否可空,
    COLUMN_COMMENT AS 注释
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'aidopdev'
  AND TABLE_NAME = 'HolidayMaster'
  AND COLUMN_NAME = 'tenant_id';

SELECT '✅ HolidayMaster 表 tenant_id 字段添加完成！' AS 状态;
