-- =============================================
-- 规划预约表新增字段：所在地区、学校、学情
-- =============================================

-- 省份
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[planner_bookings]') AND name = 'Province')
BEGIN
    ALTER TABLE [dbo].[planner_bookings] ADD [Province] NVARCHAR(50) NULL;
    PRINT N'Column Province added to planner_bookings';
END
GO

-- 城市
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[planner_bookings]') AND name = 'City')
BEGIN
    ALTER TABLE [dbo].[planner_bookings] ADD [City] NVARCHAR(50) NULL;
    PRINT N'Column City added to planner_bookings';
END
GO

-- 区县
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[planner_bookings]') AND name = 'District')
BEGIN
    ALTER TABLE [dbo].[planner_bookings] ADD [District] NVARCHAR(50) NULL;
    PRINT N'Column District added to planner_bookings';
END
GO

-- 学校
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[planner_bookings]') AND name = 'School')
BEGIN
    ALTER TABLE [dbo].[planner_bookings] ADD [School] NVARCHAR(100) NULL;
    PRINT N'Column School added to planner_bookings';
END
GO

-- 学情
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[planner_bookings]') AND name = 'StudyInfo')
BEGIN
    ALTER TABLE [dbo].[planner_bookings] ADD [StudyInfo] NVARCHAR(1000) NULL;
    PRINT N'Column StudyInfo added to planner_bookings';
END
GO

PRINT N'planner_bookings 新字段添加完成';
GO
