SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_USER](
	[UserId] [int] IDENTITY(1,1) NOT NULL,
	[GradeId] [int] NULL CONSTRAINT [DF_DB_USER_GID]  DEFAULT ((0)),
	[LevelId] [int] NULL CONSTRAINT [DF_DB_USER_LID]  DEFAULT ((0)),
	[Username] [varchar](255) NULL,
	[Password] [varchar](255) NULL,
	[Email] [varchar](255) NULL,
	[Sex] [int] NULL CONSTRAINT [DF_DB_USER_Sex]  DEFAULT ((0)),
	[Birthday] [datetime] NULL,
	[Capacity] [bigint] NULL CONSTRAINT [DF_DB_USER_Capacity]  DEFAULT ((0)),
	[Used] [bigint] NULL CONSTRAINT [DF_DB_USER_Used]  DEFAULT ((0)),
	[Header] [varchar](255) NULL,
	[State] [int] NULL CONSTRAINT [DF_DB_USER_State]  DEFAULT ((0)),
	[IP] [varchar](50) NULL,
	[First] [datetime] NULL CONSTRAINT [DF_DB_USER_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_USER_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_USER_EXTAND](
	[UserId] [int] NOT NULL CONSTRAINT [DF_DB_MORE_VALUE_UID]  DEFAULT ((0)),
	[ExtandId] [int] NOT NULL CONSTRAINT [DF_DB_MORE_VALUE_MID]  DEFAULT ((0)),
	[ExtandName] [varchar](255) NULL,
	[ExtandValue] [varchar](255) NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_FOLDER](
	[FolderId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_FOLDER_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[OwnerIP] [varchar](50) NULL,
	[StorageId] [int] NULL CONSTRAINT [DF_DB_FOLDER_StorageId]  DEFAULT ((0)),
	[ParentId] [int] NULL CONSTRAINT [DF_DB_FOLDER_ParentId]  DEFAULT ((0)),
	[DisplayPath] [varchar](255) NULL,
	[Thumb] [varchar](255) NULL,
	[Summary] [varchar](3000) NULL,
	[State] [int] NULL CONSTRAINT [DF_DB_FOLDER_State]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_FOLDER_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_FOLDER_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_EXTAND](
	[ExtandId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[Type] [int] NULL,
	[Required] [int] NULL,
	[DefaultValue] [varchar](1000) NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_MESSAGE_FILE](
	[MessageId] [int] NULL,
	[ResourceId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_ResourceId]  DEFAULT ((0)),
	[ResourceType] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_ResourceType]  DEFAULT ((0)),
	[Name] [varchar](255) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[StorageId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_StorageId]  DEFAULT ((0)),
	[FolderId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_FolderId]  DEFAULT ((0)),
	[DisplayPath] [varchar](255) NULL,
	[Type] [varchar](50) NULL,
	[Extension] [varchar](50) NULL,
	[Length] [bigint] NULL,
	[Thumb] [varchar](255) NULL,
	[State] [int] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_State]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_MESSAGE_FILE_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_POPEM](
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_RESOURCE_POPEM_OwnerId]  DEFAULT ((0)),
	[OwnerType] [int] NULL CONSTRAINT [DF_DB_RESOURCE_POPEM_OwnerType]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[ResourceId] [int] NULL CONSTRAINT [DF_DB_RESOURCE_POPEM_ResourceId]  DEFAULT ((0)),
	[ResourceType] [int] NULL CONSTRAINT [DF_DB_RESOURCE_POPEM_ResourceType]  DEFAULT ((0)),
	[ResourceName] [varchar](255) NULL,
	[PopemCreate] [int] NULL CONSTRAINT [DF_DB_RESOURCE_POPEM_PopemType]  DEFAULT ((0)),
	[PopemWrite] [int] NULL CONSTRAINT [DF_DB_POPEM_PopemManageFolder]  DEFAULT ((0)),
	[PopemEdit] [int] NULL CONSTRAINT [DF_DB_POPEM_PopemEdit]  DEFAULT ((0)),
	[PopemRead] [int] NULL CONSTRAINT [DF_DB_POPEM_PopemRead]  DEFAULT ((0)),
	[PopemDownload] [int] NULL CONSTRAINT [DF_DB_POPEM_PopemDownload]  DEFAULT ((0)),
	[Lock] [int] NULL CONSTRAINT [DF_DB_POPEM_Lock]  DEFAULT ((0))
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_MESSAGE](
	[MessageId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](5000) NULL,
	[RecvId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_RecvId]  DEFAULT ((0)),
	[RecvUsername] [varchar](255) NULL,
	[SendId] [int] NULL CONSTRAINT [DF_DB_MESSAGE_SendId]  DEFAULT ((0)),
	[SendUsername] [varchar](255) NULL,
	[State] [int] NULL CONSTRAINT [DF_DB_MESSAGE_State]  DEFAULT ((0)),
	[Files] [int] NULL CONSTRAINT [DF_DB_MESSAGE_Files]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_MESSAGE_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_MESSAGE_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_STORAGE](
	[StorageId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_STORAGE_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[Path] [varchar](255) NULL,
	[Capacity] [bigint] NULL CONSTRAINT [DF_DB_STORAGE_Capacity]  DEFAULT ((0)),
	[Used] [bigint] NULL CONSTRAINT [DF_DB_STORAGE_Used]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_STORAGE_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_STORAGE_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_CLASS](
	[ClassId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[Icon] [varchar](255) NULL,
	[Url] [varchar](255) NULL,
	[Type] [int] NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_ATTRIBUTE](
	[AttributeId] [int] IDENTITY(1,1) NOT NULL,
	[ClassId] [int] NULL CONSTRAINT [DF_DB_FILE_ATTRIBUTE_CID]  DEFAULT ((0)),
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[Type] [int] NULL CONSTRAINT [DF_DB_FILE_ATTRIBUTE_Type]  DEFAULT ((0)),
	[Required] [int] NULL CONSTRAINT [DF_DB_ATTRIBUTE_Required]  DEFAULT ((0)),
	[Special] [int] NULL CONSTRAINT [DF_DB_ATTRIBUTE_Special]  DEFAULT ((0)),
	[DefaultValue] [varchar](1000) NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_FILE_TOPIC](
	[TopicId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](5000) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_FILE_TOPIC_OwnerId]  DEFAULT ((0)),
	[OwnerIP] [varchar](50) NULL,
	[OwnerName] [varchar](255) NULL,
	[FileId] [int] NULL CONSTRAINT [DF_DB_FILE_TOPIC_FileId]  DEFAULT ((0)),
	[FileName] [varchar](255) NULL,
	[First] [datetime] NULL CONSTRAINT [DF_DB_FILE_TOPIC_First]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_GRADE](
	[GradeId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[Users] [int] NULL CONSTRAINT [DF_DB_GRADE_Users]  DEFAULT ((0)),
	[IsDefault] [int] NULL CONSTRAINT [DF_DB_GRADE_IsDefault]  DEFAULT ((0))
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_LEVEL](
	[LevelId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[Type] [int] NULL CONSTRAINT [DF_DB_LEVEL_Type]  DEFAULT ((0)),
	[Lock] [int] NULL CONSTRAINT [DF_DB_USER_LEVEL_Lock]  DEFAULT ((0)),
	[SetConfig] [int] NULL CONSTRAINT [DF_DB_USER_LEVEL_Setup]  DEFAULT ((0)),
	[SetUser] [int] NULL CONSTRAINT [DF_DB_USER_LEVEL_UserPassword]  DEFAULT ((0)),
	[SetRegister] [int] NULL CONSTRAINT [DF_DB_LEVEL_SetRegister]  DEFAULT ((0)),
	[SetFile] [int] NULL CONSTRAINT [DF_DB_USER_LEVEL_UserDelete]  DEFAULT ((0)),
	[Capacity] [bigint] NULL CONSTRAINT [DF_DB_USER_LEVEL_Capacity]  DEFAULT ((0)),
	[Users] [int] NULL CONSTRAINT [DF_DB_LEVEL_Users]  DEFAULT ((0)),
	[IsDefault] [int] NULL CONSTRAINT [DF_DB_LEVEL_IsDefault]  DEFAULT ((0))
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_ATTRIBUTE_TAG](
	[TagId] [int] IDENTITY(1,1) NOT NULL,
	[ClassId] [int] NULL CONSTRAINT [DF_DB_ATTRIBUTE_TAG_CID]  DEFAULT ((0)),
	[AttributeId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_AID]  DEFAULT ((0)),
	[Name] [varchar](255) NULL,
	[Near] [varchar](255) NULL,
	[Vouch] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_Level]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_FILE_TAG_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_FILE_TAG_Last]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_CLASS_EXTENSION](
	[ClassId] [int] NOT NULL CONSTRAINT [DF_DB_TYPE_CID]  DEFAULT ((0)),
	[Name] [varchar](255) NOT NULL,
	[Extension] [varchar](50) NOT NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_LOG](
	[LogId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_RESOURCE_LOG_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[OwnerIP] [varchar](255) NULL,
	[RelationId] [int] NULL CONSTRAINT [DF_DB_RESOURCE_LOG_ResourceId]  DEFAULT ((0)),
	[RelationType] [int] NULL CONSTRAINT [DF_DB_RESOURCE_LOG_ResourceType]  DEFAULT ((0)),
	[OperateType] [int] NULL CONSTRAINT [DF_DB_RESOURCE_LOG_OperateType]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_RESOURCE_LOG_First]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_FILE_TAG](
	[FileId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_FileId]  DEFAULT ((0)),
	[FileName] [varchar](255) NULL,
	[ClassId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_ClassId]  DEFAULT ((0)),
	[ClassName] [varchar](255) NULL,
	[AttributeId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_AttributeId]  DEFAULT ((0)),
	[AttributeName] [varchar](255) NULL,
	[TagId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_TagId]  DEFAULT ((0)),
	[TagName] [varchar](255) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_FILE_TAG_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_EXTAND_ITEM](
	[ExtandId] [int] NOT NULL,
	[Name] [varchar](50) NULL
) ON [PRIMARY]

GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [DB_FILE](
	[FileId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](255) NULL,
	[Remark] [varchar](2000) NULL,
	[OwnerId] [int] NULL CONSTRAINT [DF_DB_FILE_OwnerId]  DEFAULT ((0)),
	[OwnerName] [varchar](255) NULL,
	[OwnerIP] [varchar](50) NULL,
	[ClassId] [int] NULL CONSTRAINT [DF_DB_FILE_ClassId]  DEFAULT ((0)),
	[StorageId] [int] NULL CONSTRAINT [DF_DB_FILE_StorageId]  DEFAULT ((0)),
	[FolderId] [int] NULL CONSTRAINT [DF_DB_FILE_ParentId]  DEFAULT ((0)),
	[DisplayPath] [varchar](255) NULL,
	[Source] [int] NULL CONSTRAINT [DF_DB_FILE_SourceType]  DEFAULT ((0)),
	[Type] [varchar](50) NULL,
	[Extension] [varchar](50) NULL,
	[Length] [bigint] NULL CONSTRAINT [DF_DB_FILE_Length]  DEFAULT ((0)),
	[Thumb] [varchar](255) NULL,
	[Preview] [varchar](255) NULL,
	[Filename] [varchar](255) NULL,
	[Summary] [varchar](3000) NULL,
	[Lock] [int] NULL CONSTRAINT [DF_DB_FILE_Lock]  DEFAULT ((0)),
	[Topic] [int] NULL CONSTRAINT [DF_DB_FILE_CanTopic]  DEFAULT ((0)),
	[Vote] [int] NULL CONSTRAINT [DF_DB_FILE_CanVouch]  DEFAULT ((0)),
	[State] [int] NULL CONSTRAINT [DF_DB_FILE_State]  DEFAULT ((0)),
	[DownloadCount] [int] NULL CONSTRAINT [DF_DB_FILE_DownloadCount]  DEFAULT ((0)),
	[DisplayCount] [int] NULL CONSTRAINT [DF_DB_FILE_DisplayCount]  DEFAULT ((0)),
	[TopicCount] [int] NULL CONSTRAINT [DF_DB_FILE_TopicCount]  DEFAULT ((0)),
	[VouchCount] [int] NULL CONSTRAINT [DF_DB_FILE_VouchCount]  DEFAULT ((0)),
	[First] [datetime] NULL CONSTRAINT [DF_DB_FILE_First]  DEFAULT (getdate()),
	[Last] [datetime] NULL CONSTRAINT [DF_DB_FILE_Last]  DEFAULT (getdate())
) ON [PRIMARY]

