/* 描述: 论坛分四个部分: 1.栏目:如经济类,政治类,计算机类,军事类 2.版面:如对栏目[计算机]进行分类:JAVA,.net,php,PB 3.主题:用户在版面直接发的贴子 4.消息贴(回贴):在主题之下所发的贴子及对贴子的回贴
*/
/* 栏目 */ create table category ( categoryID int not null )
/* 版面 */ create table Forum ( forumID int not null, name varchar(255) not null, categoryID int not null foreign key references category(categoryID), description varchar(255) , ForumSortID int not null default 0, --论坛分类管理 adminID int not null, --管理者:版主 modMinVal int not null default 1, --最小验证值 modDefaultVal int not null default 1, --默认验证值,小于modMinVal将不能直接显示 createDate date not null, --创建日期 modifiedate date not null --最后修改日期
)
/* 主题 */
create table Thread ( ThreadID int primary key not null, --主题ID parentForumID int not null foreign key references Forum(ForumID), --所属版面 subject varchar(255) not null, --标题 body text not null, --内容 userID int not null, --发表用户 pointsCount int not null, --点击率 createDate date not null, --创建日期 modifiedate date not null --最后修改日期 )
/* 消息 */ create table ForumMessage ( messageID int primary key not null, --消息ID ParentThreadID int not null foreign key references Thread(ThreadID), --属于哪个主题 ParentMessageID int not null, --所属消息主题 subject varchar(255) not null, --标题 body text not null, --贴子内容 userID int not null, --发表用户 createDate date not null, --创建日期 modifiedate date not null --最后修改日期 )
--对版面进行分类 /* 如对栏目:[计算机]―>[JAVA]->[IDE工具交流]进行分类:[JBuilder]、[Eclipse]、[JDeveloper]等等 */ create table ForumSortProp ( forumID int not null foreign key references Forum(ForumID), sortID int not null, name varchar(255) not null, CONSTRAINT sortID check (sortID >0) )
数据库的设计还是分析完善中,希望大家都提出些意见! 以帮助我修正,并和大家一起分享!
|