CREATE TABLE [dbo].[BackLesson](
[ChangeID] [Int]   NOT NULL ,
[BillItemID] [Int]   NOT NULL ,
[Amount] [Int]   NULL ,
[UnitPrice] [Money]   NULL ,

CONSTRAINT [PK_BackLesson] PRIMARY KEY CLUSTERED 
(
	[ChangeID] ASC,
    [BillItemID] ASC
))
GO

CREATE TABLE [dbo].[StuLesson](
[StuLessonID] [Int]  IDENTITY(1,1) NOT NULL ,
[StuClassID] [Int]   NULL ,
[BillItemID] [Int]   NULL ,
[UnitPrice] [Money]   NULL ,
[LessonIndex] [Int]   NULL ,
[AttendID] [Int]   NULL ,
[AtStateID] [Int]   NULL ,
[ContinueReg] [Int]   NULL ,

CONSTRAINT [PK_StuLesson] PRIMARY KEY CLUSTERED 
(
	[StuLessonID] ASC
))
GO


ALTER TABLE BillItem ADD CourseProgress int
GO

ALTER TABLE BillItem ADD BackAmount int
GO

ALTER TABLE BillItem ADD ContinueReg int
GO

ALTER TABLE StuClass ADD ContinueReg int
GO

ALTER TABLE Student ADD PYSimple varchar(50)
GO

ALTER TABLE Student ADD Diploma varchar(50)
GO

ALTER TABLE Student ADD VIPLastDate datetime
GO

ALTER TABLE Student ADD SignInSMS int
GO

ALTER TABLE Student ADD FatherName varchar(50)
GO

ALTER TABLE Student ADD FatherMobileTel varchar(50)
GO

ALTER TABLE Student ADD FatherUnit varchar(150)
GO

ALTER TABLE Student ADD FatherHeadship varchar(50)
GO

ALTER TABLE Student ADD MotherName varchar(50)
GO

ALTER TABLE Student ADD MotherMobileTel varchar(50)
GO

ALTER TABLE Student ADD MotherUnit varchar(150)
GO

ALTER TABLE Student ADD MotherHeadship varchar(50)
GO

UPDATE BillItem SET CourseProgress = 0
GO

UPDATE BillItem SET BackAmount = 0
GO

UPDATE BillItem SET ContinueReg = 0
GO

UPDATE StuClass SET ContinueReg = 0
GO

UPDATE Student SET PYSimple='',SignInSMS=1,FatherName='',FatherMobileTel='',FatherUnit='',FatherHeadship='',MotherName='',MotherMobileTel='',MotherUnit='',MotherHeadship=''
GO

UPDATE Dictionary SET DictionaryType = 5 where DictionaryType = 7
GO

Update DBInfo set DateAndTime='2011-07-25'
GO