if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Applys]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Applys]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Attachments]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Attachments]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Groups]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Groups]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Logins]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Logins]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Pages]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Pages]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Posts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Posts]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Svcs]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Svcs]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Tags]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Tags]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Topics]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Topics]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_UFails]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_UFails]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_UOnlines]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_UOnlines]


if exists (select * from dbo.sysobjects where id = object_id(N'[Fanmv_Users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [Fanmv_Users]


CREATE TABLE [Fanmv_Applys] (
	[AppID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserID] [int] NULL DEFAULT (0) ,
	[AppCall] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[AppEmail] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[AppIntro] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [datetime] NULL 
)


CREATE TABLE [Fanmv_Attachments] (
	[AttID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserID] [int] NULL DEFAULT (0) ,
	[TopicID] [int] NULL DEFAULT (0) ,
	[AttType] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[AttName] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[AttPath] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[AttSize] [int] NULL DEFAULT (0) ,
	[AddTime] [datetime] NULL 
)


CREATE TABLE [Fanmv_Groups] (
	[GroupID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[GroupName] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[TopicLimit] [int] NULL DEFAULT (1) ,
	[PostLimit] [int] NULL DEFAULT (1) ,
	[GroupIcon] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[GroupTags] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[GroupIntro] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[ViewCount] [int] NULL DEFAULT (0) ,
	[TopicCount] [int] NULL DEFAULT (0) ,
	[PostCount] [int] NULL DEFAULT (0) ,
	[UserCount] [int] NULL DEFAULT (0) ,
	[IsElite] [int] NULL DEFAULT (0) ,
	[AddTime] [datetime] NULL ,
	[UpdateTime] [datetime] NULL ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
)



CREATE TABLE [Fanmv_Logins] (
	[LoginID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserID] [int] NULL DEFAULT (0) ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[ErrorCount] [int] NULL DEFAULT (0) ,
	[UpdateTime] [datetime] NULL 
)


CREATE TABLE [Fanmv_Pages] (
	[PageID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[OrderID] [int] NULL DEFAULT (0) ,
	[PageTitle] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[PageContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[VisitFile] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[VisitUrl] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
)



CREATE TABLE [Fanmv_Posts] (
	[PostID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[IsAudit] [int] NULL DEFAULT (0) ,
	[ParentID] [int] NULL DEFAULT (0) ,
	[TopicID] [int] NULL DEFAULT (0) ,
	[GroupID] [int] NULL DEFAULT (0) ,
	[UserID] [int] NULL DEFAULT (0) ,
	[NickName] [nvarchar] (24) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[PubIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[PubTime] [datetime] NULL 
)



CREATE TABLE [Fanmv_Svcs] (
	[SvcID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserID] [int] NULL DEFAULT (0) ,
	[UserName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[SvcType] [int] NULL DEFAULT (0) ,
	[SvcContent] [varchar] (39) COLLATE Chinese_PRC_CI_AS NULL ,
	[SvcTime] [datetime] NULL 
)


CREATE TABLE [Fanmv_Tags] (
	[TagID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[TagName] [nvarchar] (32) COLLATE Chinese_PRC_CI_AS NULL ,
	[TagCount] [int] NULL DEFAULT (0) ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsElite] [int] NULL DEFAULT (0) 
)


CREATE TABLE [Fanmv_Topics] (
	[TopicID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[IsAudit] [int] NULL DEFAULT (0) ,
	[GroupID] [int] NULL DEFAULT (0) ,
	[UserID] [int] NULL DEFAULT (0) ,
	[NickName] [nvarchar] (24) COLLATE Chinese_PRC_CI_AS NULL ,
	[Title] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[Intro] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsTop] [int] NULL DEFAULT (0) ,
	[IsElite] [int] NULL DEFAULT (0) ,
	[IsDigest] [int] NULL DEFAULT (0) ,
	[IsFlag] [int] NULL DEFAULT (0) ,
	[IsLock] [int] NULL DEFAULT (0) ,
	[ViewCount] [int] NULL DEFAULT (0) ,
	[PostCount] [int] NULL DEFAULT (0) ,
	[PubIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[PubTime] [datetime] NULL ,
	[UpdateTime] [datetime] NULL ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsCover] [int] NULL DEFAULT (0) ,
	[CoverPath] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL 
) 



CREATE TABLE [Fanmv_UFails] (
	[FailID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[FailNum] [int] NULL DEFAULT (0) 
)


CREATE TABLE [Fanmv_UOnlines] (
	[OnlineID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[UserName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[OSessionID] [varchar] (64) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[UpdateTime] [datetime] NULL 
) 


CREATE TABLE [Fanmv_Users] (
	[UserID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[IsLocked] [int] NULL DEFAULT (0) ,
	[UserType] [int] NULL DEFAULT (0) ,
	[UserName] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[UserPass] [varchar] (64) COLLATE Chinese_PRC_CI_AS NULL ,
	[NickName] [nvarchar] (24) COLLATE Chinese_PRC_CI_AS NULL ,
	[UserFace] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[UserSign] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [datetime] NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[ViewCount] [int] NULL DEFAULT (0) ,
	[TopicCount] [int] NULL DEFAULT (0) ,
	[PostCount] [int] NULL DEFAULT (0)  ,
	[GroupCount] [int] NULL DEFAULT (0) ,
	[IsExpert] [int] NULL DEFAULT (0) 
)