/*--******************--帖子相关表开始--******************--*/
if exists(select * from sysobjects where name = 'LordList') --论坛板块表
drop table LordList
if exists(select * from sysobjects where name = 'LordInvitation') --主贴表
drop table LordInvitation
if exists(select * from sysobjects where name = 'HeelInvitation') --跟帖表
drop table HeelInvitation
if exists(select * from sysobjects where name = 'DeleteLInvitation') --已删主贴表
drop table DeleteLInvitation
if exists(select * from sysobjects where name = 'DeleteHInvitation') --已删回帖表
drop table DeleteHInvitation
if exists(select * from sysobjects where name = 'TechniqueInvitation') --技术型帖
drop table TechniqueInvitation
if exists(select * from sysobjects where name = 'TechniqueHInvitation') --技术帖回帖
drop table TechniqueHInvitation
GOcreate table LordList
(
LLid int identity(1,1) not null primary key, --板块ID
LLTheme varchar(300) not null, --板块主题
LLAdminID int not null, --版主ID
LL int not null, --板块发帖奖励分数
LLLINUM int not null default 0, --主贴数
LLHINUM int not null default 0 --回帖数
)create table LordInvitation --主贴表
(
Lid int identity(1,1) not null primary key, --帖子ID
LuserID int not null, --发帖用户ID
LLid int not null, --所属板块ID
Ltheme varchar(30) not null, --主题
-- Lface varchar(20), --表情
Lmatter text not null, --内容
Luid int not null, --最后回帖用户ID
Lheelnum int not null, --回帖数
Lpoint int not null, --点击数
Lisup bit not null, --是否置顶
Ltime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table LordInvitation add
constraint DF_Lheelnum default(0) for Lheelnum, --回帖数为0
constraint DF_Lpoint default(0) for Lpoint, --点击数为0
constraint DF_Lisup default(0) for Lisup --不置顶
GOcreate table HeelInvitation --跟帖表
(
Hid int identity(1,1) not null primary key, --回帖ID
Huid int not null, --回帖人ID
HLid int not null, --回复原帖ID
Hmatter text not null, --回帖内容
Htime datetime DEFAULT GETDATE() --回帖时间
)
GO
alter table HeelInvitation add
constraint FK_HLid_Lid foreign key (HLid) references LordInvitation(Lid) --建立主贴回帖关联
GOcreate table DeleteLInvitation --已删主贴表
(
Lid int identity(1,1) not null primary key, --帖子ID
LuserID int not null, --发帖用户ID
LLid int not null, --所属板块ID
Ltheme varchar(30) not null, --主题
-- Lface varchar(20), --表情
Lmatter text not null, --内容
Luid int not null, --最后回帖用户ID
Lheelnum int not null, --回帖数
Lpoint int not null, --点击数
Lisup bit not null, --是否置顶
Ltime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table DeleteLInvitation add
constraint DF_DLheelnum default(0) for Lheelnum, --回帖数为0
constraint DF_DLpoint default(0) for Lpoint, --点击数为0
constraint DF_DLisup default(0) for Lisup --不置顶
GOcreate table DeleteHInvitation --已删跟帖表
(
Hid int identity(1,1) not null primary key, --回帖ID
Huid int not null, --回帖人ID
HLid int not null, --回复帖ID
Hmatter text not null, --回帖内容
Htime datetime DEFAULT GETDATE() --回帖时间
)
GOcreate table TechniqueInvitation --技术型帖
(
Tid int identity(1,1) not null primary key, --帖子编号
Ttheme varchar(50) not null, --帖子主题
Tmatter text not null, --帖子内容
TadminID int not null, --发帖版主ID
Tuid varchar(300), --提供技术的用户ID
Theelnum int not null, --回帖数
Tpoint int not null, --点击数
Tisup bit not null, --是否置顶
Ttime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table TechniqueInvitation add
constraint DF_Theelnum default (0) for Theelnum, --回帖为0
constraint DF_Tpoint default (0) for Tpoint, --点击数0
constraint DF_Tisup default (0) for Tisup --不置顶
GOcreate table TechniqueHInvitation --跟帖表
(
Tid int identity(1,1) not null primary key, --回帖ID
Tuid int not null, --回帖人ID
TLid int not null, --回复帖ID
Tmatter text not null, --回帖内容
Ttime datetime DEFAULT GETDATE() --回帖时间
)
GO
alter table TechniqueHInvitation add
constraint FK_TLid_Tid foreign key (Tid) references TechniqueInvitation(Tid) --建立主贴回帖关联
GO
if exists(select * from sysobjects where name = 'LordList') --论坛板块表
drop table LordList
if exists(select * from sysobjects where name = 'LordInvitation') --主贴表
drop table LordInvitation
if exists(select * from sysobjects where name = 'HeelInvitation') --跟帖表
drop table HeelInvitation
if exists(select * from sysobjects where name = 'DeleteLInvitation') --已删主贴表
drop table DeleteLInvitation
if exists(select * from sysobjects where name = 'DeleteHInvitation') --已删回帖表
drop table DeleteHInvitation
if exists(select * from sysobjects where name = 'TechniqueInvitation') --技术型帖
drop table TechniqueInvitation
if exists(select * from sysobjects where name = 'TechniqueHInvitation') --技术帖回帖
drop table TechniqueHInvitation
GOcreate table LordList
(
LLid int identity(1,1) not null primary key, --板块ID
LLTheme varchar(300) not null, --板块主题
LLAdminID int not null, --版主ID
LL int not null, --板块发帖奖励分数
LLLINUM int not null default 0, --主贴数
LLHINUM int not null default 0 --回帖数
)create table LordInvitation --主贴表
(
Lid int identity(1,1) not null primary key, --帖子ID
LuserID int not null, --发帖用户ID
LLid int not null, --所属板块ID
Ltheme varchar(30) not null, --主题
-- Lface varchar(20), --表情
Lmatter text not null, --内容
Luid int not null, --最后回帖用户ID
Lheelnum int not null, --回帖数
Lpoint int not null, --点击数
Lisup bit not null, --是否置顶
Ltime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table LordInvitation add
constraint DF_Lheelnum default(0) for Lheelnum, --回帖数为0
constraint DF_Lpoint default(0) for Lpoint, --点击数为0
constraint DF_Lisup default(0) for Lisup --不置顶
GOcreate table HeelInvitation --跟帖表
(
Hid int identity(1,1) not null primary key, --回帖ID
Huid int not null, --回帖人ID
HLid int not null, --回复原帖ID
Hmatter text not null, --回帖内容
Htime datetime DEFAULT GETDATE() --回帖时间
)
GO
alter table HeelInvitation add
constraint FK_HLid_Lid foreign key (HLid) references LordInvitation(Lid) --建立主贴回帖关联
GOcreate table DeleteLInvitation --已删主贴表
(
Lid int identity(1,1) not null primary key, --帖子ID
LuserID int not null, --发帖用户ID
LLid int not null, --所属板块ID
Ltheme varchar(30) not null, --主题
-- Lface varchar(20), --表情
Lmatter text not null, --内容
Luid int not null, --最后回帖用户ID
Lheelnum int not null, --回帖数
Lpoint int not null, --点击数
Lisup bit not null, --是否置顶
Ltime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table DeleteLInvitation add
constraint DF_DLheelnum default(0) for Lheelnum, --回帖数为0
constraint DF_DLpoint default(0) for Lpoint, --点击数为0
constraint DF_DLisup default(0) for Lisup --不置顶
GOcreate table DeleteHInvitation --已删跟帖表
(
Hid int identity(1,1) not null primary key, --回帖ID
Huid int not null, --回帖人ID
HLid int not null, --回复帖ID
Hmatter text not null, --回帖内容
Htime datetime DEFAULT GETDATE() --回帖时间
)
GOcreate table TechniqueInvitation --技术型帖
(
Tid int identity(1,1) not null primary key, --帖子编号
Ttheme varchar(50) not null, --帖子主题
Tmatter text not null, --帖子内容
TadminID int not null, --发帖版主ID
Tuid varchar(300), --提供技术的用户ID
Theelnum int not null, --回帖数
Tpoint int not null, --点击数
Tisup bit not null, --是否置顶
Ttime datetime DEFAULT GETDATE() --发帖时间
)
GO
alter table TechniqueInvitation add
constraint DF_Theelnum default (0) for Theelnum, --回帖为0
constraint DF_Tpoint default (0) for Tpoint, --点击数0
constraint DF_Tisup default (0) for Tisup --不置顶
GOcreate table TechniqueHInvitation --跟帖表
(
Tid int identity(1,1) not null primary key, --回帖ID
Tuid int not null, --回帖人ID
TLid int not null, --回复帖ID
Tmatter text not null, --回帖内容
Ttime datetime DEFAULT GETDATE() --回帖时间
)
GO
alter table TechniqueHInvitation add
constraint FK_TLid_Tid foreign key (Tid) references TechniqueInvitation(Tid) --建立主贴回帖关联
GO
http://dev.mysql.com/doc/refman/5.0/en/