live-forum/server/webapi/数据库脚本/v1.2.0_anti_addiction.sql
2026-03-24 11:27:37 +08:00

27 lines
1004 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- v1.2.0 防沉迷规则 数据库升级脚本
-- 目标数据库LiveForumDB业务库
-- 说明: 创建 T_AntiAddictionRules 表,存储防沉迷时段规则及受限操作类型
-- =============================================
-- 1. 创建 T_AntiAddictionRules 防沉迷规则表
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('T_AntiAddictionRules') AND type = 'U')
BEGIN
CREATE TABLE T_AntiAddictionRules (
Id INT IDENTITY(1,1) PRIMARY KEY,
StartTime TIME NOT NULL,
EndTime TIME NOT NULL,
RestrictPost BIT NOT NULL DEFAULT 0,
RestrictReply BIT NOT NULL DEFAULT 0,
RestrictFlower BIT NOT NULL DEFAULT 0,
CreatedAt DATETIME2 NOT NULL DEFAULT GETDATE(),
UpdatedAt DATETIME2 NOT NULL DEFAULT GETDATE()
);
PRINT '✓ T_AntiAddictionRules 表创建成功'
END
ELSE
BEGIN
PRINT '⚠ T_AntiAddictionRules 表已存在,跳过创建'
END
PRINT 'v1.2.0 防沉迷规则升级脚本执行完成';