/* 管理入口的管理帐号建表需要的脚本 */
CREATE TABLE [dbo].[admin] (
	[username] [varchar] (50) NULL ,
	[pass] [varchar] (50) NULL 
) ON [PRIMARY]
GO
/* 缺省的管理帐号: zwok 密码：ichat　系统安装成功后请注意立即修改*/
INSERT INTO admin VALUES('zwok','ichat')


/* 以下为头像商店2.0版建表需要的脚本 */
CREATE TABLE [dbo].[Products] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductName] [varchar] (50) NOT NULL ,
	[ProductHtml] [varchar] (255) NOT NULL ,
	[Facies] [varchar] (255) NOT NULL ,
	[Type] [int] NOT NULL ,
	[Quantity] [int] NULL ,
	[Price] [int] NULL ,
	[Sells] [int] NULL ,
	[ProductLevel] [int] NULL ,
	[Memo] [varchar] (255) NULL ,
	[CreateDate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[UserBox] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[ProductName] [varchar] (50) NOT NULL ,
	[ProductHtml] [varchar] (255) NOT NULL ,
	[Facies] [varchar] (255) NOT NULL ,
	[Type] [int] NOT NULL ,
	[Quantity] [int] NULL ,
	[Price] [int] NULL ,
	[UserLevel] [int] NULL ,
	[Memo] [varchar] (255) NULL ,
	[CreateDate] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[message] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sender] [varchar] (50) NULL ,
	[incept] [varchar] (50) NULL ,
	[title] [varchar] (100) NULL ,
	[content] [varchar] (1000) NULL ,
	[flag] [int] NULL ,
	[sendtime] [datetime] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Products] WITH NOCHECK ADD 
	CONSTRAINT [PK_Products] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[UserBox] WITH NOCHECK ADD 
	CONSTRAINT [PK_UserBox] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[message] WITH NOCHECK ADD 
	CONSTRAINT [PK_message] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Products] WITH NOCHECK ADD 
	CONSTRAINT [DF_Products_Sells] DEFAULT (0) FOR [Sells],
	CONSTRAINT [DF_Products_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
GO

ALTER TABLE [dbo].[UserBox] WITH NOCHECK ADD 
	CONSTRAINT [DF_UserBox_CreateDate] DEFAULT (getdate()) FOR [CreateDate]
GO

ALTER TABLE [dbo].[message] WITH NOCHECK ADD 
	CONSTRAINT [DF_message_flag] DEFAULT (1) FOR [flag],
	CONSTRAINT [DF_message_sendtime] DEFAULT (getdate()) FOR [sendtime]
GO


