-- 创建点赞表 T_isLike（如果不存在）
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[T_isLike]') AND type in (N'U'))
BEGIN
    CREATE TABLE [dbo].[T_isLike] (
        [F_id] INT IDENTITY(1,1) PRIMARY KEY,
        [f_wid] INT NOT NULL,
        [F_type] NVARCHAR(50) NOT NULL,
        [F_empName] NVARCHAR(100) NOT NULL,
        [F_empId] INT,
        [F_createtime] DATETIME DEFAULT GETDATE()
    );
    
    CREATE INDEX idx_T_isLike_f_wid_F_type ON [dbo].[T_isLike] (f_wid, F_type);
    CREATE INDEX idx_T_isLike_F_empName ON [dbo].[T_isLike] (F_empName);
END
GO

-- 创建评论表 T_empComment（如果不存在）
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[T_empComment]') AND type in (N'U'))
BEGIN
    CREATE TABLE [dbo].[T_empComment] (
        [F_id] INT IDENTITY(1,1) PRIMARY KEY,
        [f_wid] INT NOT NULL,
        [F_type] NVARCHAR(50) NOT NULL,
        [empName] NVARCHAR(100) NOT NULL,
        [empId] INT,
        [empContent] NVARCHAR(MAX) NOT NULL,
        [F_createtime] DATETIME DEFAULT GETDATE()
    );
    
    CREATE INDEX idx_T_empComment_f_wid_F_type ON [dbo].[T_empComment] (f_wid, F_type);
    CREATE INDEX idx_T_empComment_empName ON [dbo].[T_empComment] (empName);
END
GO
