/******  2014-2-25¸üÐÂ 5.4--5.5 ¿ªÊ¼******/
/******e_eachedition*****/
alter table [dbo].[e_eachedition] ADD [scopeople] [int] NULL,[average] [decimal](3, 1) NULL
GO
UPDATE [dbo].[e_eachedition] SET [scopeople]=0,[average]=0
GO
drop table [dbo].[e_pinfoedition]
GO

/*below 20140229 update*/
alter  table [dbo].[e_eachedition]  drop column isfee
GO
alter  table [dbo].[e_eachqi]  drop column isfee
GO
alter  table [dbo].[e_news]  drop column isfee
GO
alter  table [dbo].[e_setting] drop column istxt
GO
alter table [dbo].[e_setting] ADD [isfee] [bit] NULL
GO
UPDATE [dbo].[e_setting] SET isfee=0 where id=1
GO
alter table [dbo].[mvc_userreg] ADD [packageid] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
    [starttime] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
    [endtime] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
    [birthday] [datetime] NULL , 
	[sex] [tinyint] NULL , 
	[hangye] [tinyint] NULL , 
	[zhiwu] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL ,
	[xueli] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL 
GO

if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[e_package]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[e_package] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[pname] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[pfee]  [decimal](8,2) NULL ,
	[pdes] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[daypre] [int] NULL ,
	[daypredes] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[daynext] [int] NULL ,
	[daynextdes] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[pfixed] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[sortid] [int] NULL
) ON [PRIMARY] 
GO

if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[e_order]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
CREATE TABLE [dbo].[e_order] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[ordernum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[userid] [int] NULL ,
	[packageid] [int] NULL ,
	[feedate] [datetime] NULL , 
	[ordertime] [datetime] NULL,
	[status] [tinyint] NULL 
) ON [PRIMARY] 
GO

if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_e_order]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[e_order] WITH NOCHECK ADD 
	CONSTRAINT [PK_e_order] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO
if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_e_package]') and OBJECTPROPERTY(id, N'IsPrimaryKey') = 1)
BEGIN
ALTER TABLE [dbo].[e_package] WITH NOCHECK ADD 
	CONSTRAINT [PK_e_package] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
END
GO
alter table [dbo].[e_ping] ADD [pagename] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL,[newstitle] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,[issuedate] [varchar] (30) COLLATE Chinese_PRC_CI_AS NULL 
GO
UPDATE [dbo].[e_ping] SET [pagename]='',[newstitle]='',[issuedate]=''
GO
