/****** Object:  Table [dbo].[UserRole]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserRole]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserRole]
GO

CREATE TABLE [dbo].[UserRole] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NameC] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_UserRole] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[UserRole]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'UserRole', N'column', N'ID'
GO
exec sp_addextendedproperty N'MS_Description', N'角色名', N'user', N'dbo', N'table', N'UserRole', N'column', N'Name'
GO
exec sp_addextendedproperty N'MS_Description', N'中文角色名', N'user', N'dbo', N'table', N'UserRole', N'column', N'NameC'


GO


/****** Object:  Table [dbo].[UserFlag]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserFlag]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserFlag]
GO

CREATE TABLE [dbo].[UserFlag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NameC] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_UserFlag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[UserFlag]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'UserFlag', N'column', N'ID'


GO


/****** Object:  Table [dbo].[Sex]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Sex]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Sex]
GO

CREATE TABLE [dbo].[Sex] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NameC] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_Sex] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[Sex]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'Sex', N'column', N'ID'


GO


/****** Object:  Table [dbo].[TopicStatus]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[TopicStatus]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[TopicStatus]
GO

CREATE TABLE [dbo].[TopicStatus] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NameC] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[DescriptionC] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[IconName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_TopicStatus] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[TopicStatus]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'TopicStatus', N'column', N'ID'


GO


/****** Object:  Table [dbo].[Topic]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Topic]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Topic]
GO

CREATE TABLE [dbo].[Topic] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ForumID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatus] [int] NULL CONSTRAINT [DF_Topic_TopicStatus] DEFAULT (1),
	[User] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PostTime] [datetime] NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Hit] [int] NULL CONSTRAINT [DF_Topic_Hit] DEFAULT (0),
	[AttachmentName] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_Topic] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Topic]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'论坛编号（来自 menu.xml），使用数字', N'user', N'dbo', N'table', N'Topic', N'column', N'ForumID'
GO
exec sp_addextendedproperty N'MS_Description', N'主题状态，却省为 1 （空主题）', N'user', N'dbo', N'table', N'Topic', N'column', N'TopicStatus'
GO
exec sp_addextendedproperty N'MS_Description', N'用户 ID', N'user', N'dbo', N'table', N'Topic', N'column', N'User'
GO
exec sp_addextendedproperty N'MS_Description', N'发表时间', N'user', N'dbo', N'table', N'Topic', N'column', N'PostTime'
GO
exec sp_addextendedproperty N'MS_Description', N'标题，最多 200 汉字', N'user', N'dbo', N'table', N'Topic', N'column', N'Title'
GO
exec sp_addextendedproperty N'MS_Description', N'内容，最多 3500 汉字', N'user', N'dbo', N'table', N'Topic', N'column', N'Content'
GO
exec sp_addextendedproperty N'MS_Description', N'点击次数，每次运行 SP TopicSelect，该值都++', N'user', N'dbo', N'table', N'Topic', N'column', N'Hit'
GO
exec sp_addextendedproperty N'MS_Description', N'附件路径，由于 URL 可能很长，所以取 2000', N'user', N'dbo', N'table', N'Topic', N'column', N'AttachmentName'


GO


/****** Object:  Table [dbo].[FollowUp]    Script Date: 2013-11-13 7:11:49 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FollowUp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[FollowUp]
GO

CREATE TABLE [dbo].[FollowUp] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[TopicID] [int] NULL ,
	[User] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PostTime] [datetime] NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[AttachmentName] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_Message] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[FollowUp]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'FollowUp', N'column', N'ID'
GO
exec sp_addextendedproperty N'MS_Description', N'主题 ID', N'user', N'dbo', N'table', N'FollowUp', N'column', N'TopicID'
GO
exec sp_addextendedproperty N'MS_Description', N'帖子用户', N'user', N'dbo', N'table', N'FollowUp', N'column', N'User'
GO
exec sp_addextendedproperty N'MS_Description', N'发帖时间', N'user', N'dbo', N'table', N'FollowUp', N'column', N'PostTime'
GO
exec sp_addextendedproperty N'MS_Description', N'帖子内容，使用 ntext ，不限长度', N'user', N'dbo', N'table', N'FollowUp', N'column', N'Content'
GO
exec sp_addextendedproperty N'MS_Description', N'附件路径，由于 URL 可能很长，所以取 2000', N'user', N'dbo', N'table', N'FollowUp', N'column', N'AttachmentName'


GO


/****** Object:  Table [dbo].[KeywordFlag]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[KeywordFlag]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[KeywordFlag]
GO

CREATE TABLE [dbo].[KeywordFlag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NameC] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_KeywordFlag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[KeywordFlag]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'KeywordFlag', N'column', N'ID'


GO


/****** Object:  Table [dbo].[CommunityContent]    Script Date: 2013-11-13 7:11:49 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CommunityContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CommunityContent]
GO

CREATE TABLE [dbo].[CommunityContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CommunityID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[CommandTitleTaskList] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleTaskListDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleAdd] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleAddDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleQuery] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleQueryDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationEmptyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationSolidTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationHotTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationEliteTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationTabooTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationStickyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetEliteTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetTabooTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetStickyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_CommunityContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_Community_ID] ON [dbo].[CommunityContent]([CommunityID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[CommunityContent]  TO [public]
GO


/****** Object:  Table [dbo].[UserForums]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserForums]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserForums]
GO

CREATE TABLE [dbo].[UserForums] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[User] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Forum] [int] NULL ,
	[ReadEnabled] [int] NULL ,
	[TopicWriteEnabled] [int] NULL ,
	[FollowUpWriteEnabled] [int] NULL ,
	CONSTRAINT [PK_UserForums] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[UserForums]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'2010-11-24：该表停用', N'user', N'dbo', N'table', N'UserForums', N'column', N'ID'


GO


/****** Object:  Table [dbo].[OptionContent]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[OptionContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[OptionContent]
GO

CREATE TABLE [dbo].[OptionContent] (
	[ID] [int] NULL ,
	[OptionID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[CatTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (3000) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_Option_ID] ON [dbo].[OptionContent]([OptionID]) ON [PRIMARY]
GO

 CREATE  INDEX [IX_OptionContent_ID] ON [dbo].[OptionContent]([ID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[OptionContent]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'对应的 Option 记录的 ID', N'user', N'dbo', N'table', N'OptionContent', N'column', N'OptionID'
GO
exec sp_addextendedproperty N'MS_Description', N'文化名', N'user', N'dbo', N'table', N'OptionContent', N'column', N'Culture'
GO
exec sp_addextendedproperty N'MS_Description', N'参数标题', N'user', N'dbo', N'table', N'OptionContent', N'column', N'Title'
GO
exec sp_addextendedproperty N'MS_Description', N'参数所属大类的标题', N'user', N'dbo', N'table', N'OptionContent', N'column', N'CatTitle'
GO
exec sp_addextendedproperty N'MS_Description', N'参数描述性文本', N'user', N'dbo', N'table', N'OptionContent', N'column', N'Description'


GO


/****** Object:  Table [dbo].[Forum]    Script Date: 2013-11-13 7:11:49 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Forum]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Forum]
GO

CREATE TABLE [dbo].[Forum] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CommunityID] [int] NULL ,
	[Serial] [int] NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Moderator] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Public] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReadPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicWritePermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[FollowUpWritePermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_Forum] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Forum]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'Forum', N'column', N'ID'
GO
exec sp_addextendedproperty N'MS_Description', N'对应的 Community 的 ID', N'user', N'dbo', N'table', N'Forum', N'column', N'CommunityID'
GO
exec sp_addextendedproperty N'MS_Description', N'根据 Serial 决定该项目在界面中的显示次序', N'user', N'dbo', N'table', N'Forum', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'该论坛斑竹的列表 "lily,cici,35公里"', N'user', N'dbo', N'table', N'Forum', N'column', N'Moderator'
GO
exec sp_addextendedproperty N'MS_Description', N'当前 Forum 是否公共 Forum ', N'user', N'dbo', N'table', N'Forum', N'column', N'Public'


GO


/****** Object:  Table [dbo].[UniqueNumber]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UniqueNumber]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UniqueNumber]
GO

CREATE TABLE [dbo].[UniqueNumber] (
	[Number] [int] NOT NULL 
) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[UniqueNumber]  TO [public]
GO


/****** Object:  Table [dbo].[SeaParameter]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SeaParameter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SeaParameter]
GO

CREATE TABLE [dbo].[SeaParameter] (
	[ID] [int] NOT NULL ,
	[Parameter] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Value] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_SeaParameter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT  ON [dbo].[SeaParameter]  TO [public]
GO


/****** Object:  Table [dbo].[KnowledgeTags]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[KnowledgeTags]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[KnowledgeTags]
GO

CREATE TABLE [dbo].[KnowledgeTags] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[KnowledgeContentID] [int] NULL ,
	[Tag] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_KnowledgeTags] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_KnowledgeContent_ID] ON [dbo].[KnowledgeTags]([KnowledgeContentID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[KnowledgeTags]  TO [public]
GO


/****** Object:  Table [dbo].[SubDirectory]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubDirectory]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SubDirectory]
GO

CREATE TABLE [dbo].[SubDirectory] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MainDirectoryID] [int] NULL ,
	[Serial] [int] NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[NewWindow] [bit] NULL ,
	[Overview] [bit] NULL ,
	[Wizard] [bit] NULL ,
	[Editor] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[DedicatedTo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[CommentsPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_SubDirectory] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[SubDirectory]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'序列号越大的越排在后面', N'user', N'dbo', N'table', N'SubDirectory', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'如果属于 New Window，则为 "true"，否则为 "false"', N'user', N'dbo', N'table', N'SubDirectory', N'column', N'NewWindow'


GO


/****** Object:  Table [dbo].[Option]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Option]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Option]
GO

CREATE TABLE [dbo].[Option] (
	[ID] [int] NULL ,
	[Cat] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[RightIndent] [int] NULL CONSTRAINT [Option_Default_Constraint] DEFAULT (0),
	[Key] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Value] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Legend] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NumberOnly] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TextArea] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MultiCulture] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ForTheme] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Validation] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_Option_ID] ON [dbo].[Option]([ID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Option]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'当前参数所在的 Cat', N'user', N'dbo', N'table', N'Option', N'column', N'Cat'
GO
exec sp_addextendedproperty N'MS_Description', N'参数名', N'user', N'dbo', N'table', N'Option', N'column', N'Key'
GO
exec sp_addextendedproperty N'MS_Description', N'参数值', N'user', N'dbo', N'table', N'Option', N'column', N'Value'
GO
exec sp_addextendedproperty N'MS_Description', N'一般用一个或几个字母表示当前 Option 在 Cat 示例图中的位置。', N'user', N'dbo', N'table', N'Option', N'column', N'Legend'
GO
exec sp_addextendedproperty N'MS_Description', N'true/false', N'user', N'dbo', N'table', N'Option', N'column', N'NumberOnly'
GO
exec sp_addextendedproperty N'MS_Description', N'true/false', N'user', N'dbo', N'table', N'Option', N'column', N'TextArea'


GO


/****** Object:  Table [dbo].[Knowledge]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Knowledge]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Knowledge]
GO

CREATE TABLE [dbo].[Knowledge] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PageDirectoryID] [int] NULL ,
	[Serial] [int] NULL ,
	[Editor] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[DedicatedTo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[CommentsPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[UpdateTime] [datetime] NULL ,
	[Author] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[KnowledgeType] [int] NULL ,
	CONSTRAINT [PK_Knowledge] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_Knowledge_Cat] ON [dbo].[Knowledge]([PageDirectoryID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Knowledge]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'相当于 ActivePageMenuName', N'user', N'dbo', N'table', N'Knowledge', N'column', N'PageDirectoryID'
GO
exec sp_addextendedproperty N'MS_Description', N'序列号越大的越排在后面', N'user', N'dbo', N'table', N'Knowledge', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'本内容专门为哪些用户准备，用"," 隔开用户，如果给全部注册用户者，则用“*”，如果公开，则使用空字符或 null', N'user', N'dbo', N'table', N'Knowledge', N'column', N'DedicatedTo'
GO
exec sp_addextendedproperty N'MS_Description', N'本内容允许哪些用户评论，用 “,” 隔开的用户列表，如果全部注册用户都可以评论，则使用“*”，如果任何访问者都可以评论，则使用字符或 null，如果不允许任何评论，则使用“none”.', N'user', N'dbo', N'table', N'Knowledge', N'column', N'CommentsPermission'


GO


/****** Object:  Table [dbo].[MainDirectory]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MainDirectory]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MainDirectory]
GO

CREATE TABLE [dbo].[MainDirectory] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Serial] [int] NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[NewWindow] [bit] NULL ,
	[System] [bit] NULL ,
	[InActiveMainMenuIconMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ActiveMainMenuIconMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BannerMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BannerContentLayer] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Editor] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[DedicatedTo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[CommentsPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_MainDirectory] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[MainDirectory]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'序列号：序列号越大的，越排在后面', N'user', N'dbo', N'table', N'MainDirectory', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'如果属于 System 菜单，则为 "true"，否则为 "false"', N'user', N'dbo', N'table', N'MainDirectory', N'column', N'System'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'MainDirectory', N'column', N'InActiveMainMenuIconMap'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'MainDirectory', N'column', N'ActiveMainMenuIconMap'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'MainDirectory', N'column', N'BannerMap'


GO


/****** Object:  Table [dbo].[ResourcesTags]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ResourcesTags]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ResourcesTags]
GO

CREATE TABLE [dbo].[ResourcesTags] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ResourcesID] [int] NULL ,
	[Tag] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_ResourcesTags] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_Resources_ID] ON [dbo].[ResourcesTags]([ResourcesID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[ResourcesTags]  TO [public]
GO


/****** Object:  Table [dbo].[UserGroup]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserGroup]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserGroup]
GO

CREATE TABLE [dbo].[UserGroup] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[GroupName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[RegisterDefault] [int] NULL ,
	CONSTRAINT [PK_UserGroup] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[UserGroup]  TO [public]
GO


/****** Object:  Table [dbo].[UserGroups]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UserGroups]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[UserGroups]
GO

CREATE TABLE [dbo].[UserGroups] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserGroupID] [int] NULL ,
	[User] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_UserGroups] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_UserGroup_ID] ON [dbo].[UserGroups]([UserGroupID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[UserGroups]  TO [public]
GO


/****** Object:  Table [dbo].[Users]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Users]
GO

CREATE TABLE [dbo].[Users] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Password] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[FirstName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LastName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Sex] [int] NULL ,
	[Tel] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Email] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Fax] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MSN] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Skype] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Twitter] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[QQ] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Organization] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Position] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Rank] [int] NULL CONSTRAINT [Users_Rank_Default_Constraint] DEFAULT (1000000),
	[PortraitName] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[RegisterDate] [datetime] NULL ,
	[UserRole] [int] NULL ,
	CONSTRAINT [PK_Users] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Users]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'Users', N'column', N'ID'
GO
exec sp_addextendedproperty N'MS_Description', N'用户名', N'user', N'dbo', N'table', N'Users', N'column', N'Name'
GO
exec sp_addextendedproperty N'MS_Description', N'密码，加密形式', N'user', N'dbo', N'table', N'Users', N'column', N'Password'
GO
exec sp_addextendedproperty N'MS_Description', N'姓', N'user', N'dbo', N'table', N'Users', N'column', N'FirstName'
GO
exec sp_addextendedproperty N'MS_Description', N'名', N'user', N'dbo', N'table', N'Users', N'column', N'LastName'
GO
exec sp_addextendedproperty N'MS_Description', N'性别', N'user', N'dbo', N'table', N'Users', N'column', N'Sex'
GO
exec sp_addextendedproperty N'MS_Description', N'电话', N'user', N'dbo', N'table', N'Users', N'column', N'Tel'
GO
exec sp_addextendedproperty N'MS_Description', N'电子邮件', N'user', N'dbo', N'table', N'Users', N'column', N'Email'
GO
exec sp_addextendedproperty N'MS_Description', N'角色 - Admin, Community', N'user', N'dbo', N'table', N'Users', N'column', N'UserRole'


GO


/****** Object:  Table [dbo].[SiteLog]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SiteLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SiteLog]
GO

CREATE TABLE [dbo].[SiteLog] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[User] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Activity] [int] NULL ,
	[TargetID] [int] NULL ,
	[ActivityTime] [datetime] NULL ,
	CONSTRAINT [PK_SiteLog] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[SiteLog]  TO [public]
GO


/****** Object:  Table [dbo].[KnowledgeComments]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[KnowledgeComments]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[KnowledgeComments]
GO

CREATE TABLE [dbo].[KnowledgeComments] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[KnowledgeContentID] [int] NULL ,
	[CommentsTime] [datetime] NULL ,
	[CommentsUser] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommentsContent] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_KnowledgeComments] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_KnowledgeContent_ID] ON [dbo].[KnowledgeComments]([KnowledgeContentID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[KnowledgeComments]  TO [public]
GO


/****** Object:  Table [dbo].[MainDirectoryContent]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MainDirectoryContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[MainDirectoryContent]
GO

CREATE TABLE [dbo].[MainDirectoryContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MainDirectoryID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[HiddenInNavigationOnly] [bit] NULL ,
	[PageHeader] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[PageFooter] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Url] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[ThisIsLink] [bit] NULL ,
	CONSTRAINT [PK_MainDirectoryContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_MainDirectory_ID] ON [dbo].[MainDirectoryContent]([MainDirectoryID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[MainDirectoryContent]  TO [public]
GO


/****** Object:  Table [dbo].[SubDirectoryContent]    Script Date: 2013-11-13 7:11:51 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SubDirectoryContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SubDirectoryContent]
GO

CREATE TABLE [dbo].[SubDirectoryContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[SubDirectoryID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[WizardPreviousTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[WizardNextTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[HiddenInNavigationOnly] [bit] NULL ,
	[PageHeader] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[PageFooter] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Url] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[ThisIsLink] [bit] NULL ,
	CONSTRAINT [PK_SubDirectoryContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_SubDirectory_ID] ON [dbo].[SubDirectoryContent]([SubDirectoryID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[SubDirectoryContent]  TO [public]
GO


/****** Object:  Table [dbo].[KnowledgeContent]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[KnowledgeContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[KnowledgeContent]
GO

CREATE TABLE [dbo].[KnowledgeContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[KnowledgeID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Tag] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[Approved] [int] NULL CONSTRAINT [KnowledgeContent_Approved_Default_Constraint] DEFAULT (1),
	[ApproveMessage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ApprovedBy] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Abstract] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[HitCount] [int] NULL ,
	CONSTRAINT [PK_KnowledgeContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_Knowledge_ID] ON [dbo].[KnowledgeContent]([KnowledgeID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[KnowledgeContent]  TO [public]
GO


/****** Object:  Table [dbo].[PageDirectoryContent]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PageDirectoryContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PageDirectoryContent]
GO

CREATE TABLE [dbo].[PageDirectoryContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PageDirectoryID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[OutlineMode] [bit] NULL ,
	[SeoTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[SeoDescription] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[SeoKeywords] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Template] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[HiddenInNavigationOnly] [bit] NULL ,
	[PageHeader] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[PageFooter] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Url] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[ThisIsLink] [bit] NULL ,
	CONSTRAINT [PK_PageDirectoryContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

 CREATE  INDEX [IX_PageDirectory_ID] ON [dbo].[PageDirectoryContent]([PageDirectoryID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[PageDirectoryContent]  TO [public]
GO


/****** Object:  Table [dbo].[Community]    Script Date: 2013-11-13 7:11:49 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Community]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Community]
GO

CREATE TABLE [dbo].[Community] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Serial] [int] NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Moderator] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Public] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[InActiveMainMenuIconMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ActiveMainMenuIconMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BannerMap] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[BannerContentLayer] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ReadPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicWritePermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[FollowUpWritePermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_Community] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Community]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'自动增长', N'user', N'dbo', N'table', N'Community', N'column', N'ID'
GO
exec sp_addextendedproperty N'MS_Description', N'根据 Serial 决定该项目在界面中出现次序', N'user', N'dbo', N'table', N'Community', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'Community', N'column', N'InActiveMainMenuIconMap'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'Community', N'column', N'ActiveMainMenuIconMap'
GO
exec sp_addextendedproperty N'MS_Description', N'多语种', N'user', N'dbo', N'table', N'Community', N'column', N'BannerMap'


GO


/****** Object:  Table [dbo].[ForumContent]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ForumContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[ForumContent]
GO

CREATE TABLE [dbo].[ForumContent] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ForumID] [int] NULL ,
	[Culture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[CommandTitleTaskList] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleTaskListDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleAdd] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleAddDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleQuery] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[CommandTitleQueryDescription] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationEmptyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationSolidTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationHotTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationEliteTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationTabooTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicStatusCustomizationStickyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetEliteTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetTabooTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicCommandSetStickyTopic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_ForumContent] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY]
GO

 CREATE  INDEX [IX_Forum_ID] ON [dbo].[ForumContent]([ForumID]) ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[ForumContent]  TO [public]
GO


/****** Object:  Table [dbo].[Resources]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Resources]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Resources]
GO

CREATE TABLE [dbo].[Resources] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[LogicalPath] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NULL ,
	[FileDate] [datetime] NULL ,
	[DimensionWidth] [int] NULL ,
	[DimensionHeight] [int] NULL ,
	[FileSize] [bigint] NULL ,
	[Tag] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Summary] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Hidden] [bit] NULL ,
	[Approved] [int] NULL CONSTRAINT [Resources_Approved_Default_Constraint] DEFAULT (1),
	[ApproveMessage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ApprovedBy] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Score] [int] NULL ,
	[ScoreCount] [int] NULL ,
	CONSTRAINT [PK_Resources] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[Resources]  TO [public]
GO


/****** Object:  Table [dbo].[PageDirectory]    Script Date: 2013-11-13 7:11:50 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PageDirectory]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[PageDirectory]
GO

CREATE TABLE [dbo].[PageDirectory] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[SubDirectoryID] [int] NULL ,
	[Serial] [int] NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[PageSize] [int] NULL ,
	[NewWindow] [bit] NULL ,
	[Overview] [bit] NULL ,
	[FastAccess] [bit] NULL ,
	[Home] [bit] NULL ,
	[RightIndent] [int] NULL CONSTRAINT [PageDirectory_Default_Constraint] DEFAULT (0),
	[jQuery] [bit] NULL ,
	[LogoHide] [bit] NULL ,
	[MainMenuHide] [bit] NULL ,
	[BannerHide] [bit] NULL ,
	[BreadcrumbHide] [bit] NULL ,
	[PageMenuHide] [bit] NULL ,
	[PageBarHide] [bit] NULL ,
	[CopyrightHide] [bit] NULL ,
	[Type] [int] NULL ,
	[Presentation] [int] NULL ,
	[JumpToContent] [bit] NULL ,
	[ShowTitle] [bit] NULL ,
	[ShowAuthor] [bit] NULL ,
	[ShowUpdateTime] [bit] NULL ,
	[ShowHitCount] [bit] NULL ,
	[ShowComments] [bit] NULL ,
	[ShowStaticUrl] [bit] NULL ,
	[ShowKnowledgeHtml] [bit] NULL ,
	[ShowRelative] [bit] NULL ,
	[Editor] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[DedicatedTo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[CommentsPermission] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_PageDirectory] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

GRANT  SELECT ,  UPDATE ,  INSERT ,  DELETE  ON [dbo].[PageDirectory]  TO [public]
GO


exec sp_addextendedproperty N'MS_Description', N'序列号越大的越排在后面', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'Serial'
GO
exec sp_addextendedproperty N'MS_Description', N'是否弹出新窗口 - true/false', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'NewWindow'
GO
exec sp_addextendedproperty N'MS_Description', N'是否加入快速访问列表 - true/false', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'FastAccess'
GO
exec sp_addextendedproperty N'MS_Description', N'是否作为首页 - true/false', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'Home'
GO
exec sp_addextendedproperty N'MS_Description', N'当前页隐藏 Page Menu 侧条，一般在首页，扩大工作面积', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'PageMenuHide'
GO
exec sp_addextendedproperty N'MS_Description', N'知识类型： 1-普通知识   2-基于时间的知识，如博客，新闻等   3-分门别类型知识，如 Grossary,Faq,招聘', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'Type'
GO
exec sp_addextendedproperty N'MS_Description', N'知识的展示方式： 1-正常显示（按页显示全部内容）    2-只显示标题（显示标题，点击标题后，展示具体内容）    3-显示摘要（例如显示博客摘要内容，点击后显示具体内容）', N'user', N'dbo', N'table', N'PageDirectory', N'column', N'Presentation'


GO


