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

27 lines
1.1 KiB
SQL
Raw Permalink 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_PostReplyIntervals 表,按认证等级配置发帖和回复的最小时间间隔
-- =============================================
-- 1. 创建 T_PostReplyIntervals 时间间隔配置表
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('T_PostReplyIntervals') AND type = 'U')
BEGIN
CREATE TABLE T_PostReplyIntervals (
Id INT IDENTITY(1,1) PRIMARY KEY,
CertificationTypeId INT NOT NULL,
PostInterval INT NOT NULL DEFAULT 0,
ReplyInterval INT NOT NULL DEFAULT 0,
CreatedAt DATETIME2 NOT NULL DEFAULT GETDATE(),
UpdatedAt DATETIME2 NOT NULL DEFAULT GETDATE(),
CONSTRAINT UQ_PostReplyIntervals_CertTypeId UNIQUE (CertificationTypeId),
CONSTRAINT FK_PostReplyIntervals_CertType FOREIGN KEY (CertificationTypeId) REFERENCES T_CertificationTypes(Id)
);
PRINT '✓ T_PostReplyIntervals 表创建成功'
END
ELSE
BEGIN
PRINT '⚠ T_PostReplyIntervals 表已存在,跳过创建'
END
PRINT 'v1.2.0 发帖和回复时间间隔升级脚本执行完成';