
/*******************************
* Made in date : 2004-03-26
* DESCRIPTION : TO USE WHEN USER LOG IN A GAME
* EDIT : 2005-02-28
* ******************************/

-- LOCATION DBNAME : RYLBillingDB
CREATE TABLE dbo.[TblAdminSetting] (
	[AdminID] [char] (1) NULL ,
	[RightID] [smallint] NULL ,
	[RightValue] [bit] NULL ,
	[descriptionRightID] [varchar] (20) NULL 
) 

GO

CREATE TABLE dbo.[TblToolAdmin] (
	[strAdminID] [varchar] (20)  NOT NULL ,
	[strPasswd] [varchar] (20)  NOT NULL ,
	[strLevel] [varchar] (2)  NOT NULL ,
	[strName] [varchar] (7)  NULL ,
	[strIP] [varchar] (16)  NULL ,
	[dateRegit] [smalldatetime] NULL CONSTRAINT [DF__TblToolAd__dateR__3B40CD36] DEFAULT (getdate()),
	 PRIMARY KEY  CLUSTERED 
	(
		[strAdminID]
	) WITH  FILLFACTOR = 90   
) 

GO


CREATE TABLE dbo.[TblCRM_RYLLOG] (
	[intIndex] [int] NOT NULL ,
	[strCRMCode] [varchar] (15)  NOT NULL ,
	[strPriceType] [char] (1)  NOT NULL ,
	[dateSysDay] [smalldatetime] NOT NULL ,
	[strCommand] [char] (1)  NULL ,
	[strCRMIP1] [varchar] (12)  NULL ,
	[strStartCRMIP1] [tinyint] NULL ,
	[strEndCRMIP1] [tinyint] NULL ,
	[strCRMIP2] [varchar] (12)  NULL ,
	[strStartCRMIP2] [tinyint] NULL ,
	[strEndCRMIP2] [tinyint] NULL ,
	[strCRMIP3] [varchar] (12)  NULL ,
	[strStartCRMIP3] [tinyint] NULL ,
	[strEndCRMIP3] [tinyint] NULL ,
	[strTimeprocess] [char] (1)  NULL ,
	[intServiceTime] [int] NULL ,
	[dateServiceDay] [smalldatetime] NULL ,
	[TinyServiceIPNum] [tinyint] NULL ,
	[dateEndday] [smalldatetime] NULL ,
	[intEndTime] [int] NULL ,
	[strRYLCHK] [char] (1)  NULL ,
	[strConvertCHK] [char] (1)  NULL CONSTRAINT [DF__TblCRM_RY__strCo__0697FACD] DEFAULT ('N'),
	 CHECK ([strPriceType] = 'T' or [strPriceType] = 'D')
) 

GO

CREATE TABLE dbo.[TblCRM_SERVICETIME] (
	[strCRMCode] [varchar] (20)  NULL ,
	[strGameCode] [char] (3)  NULL ,
	[intServiceTime] [int] NULL ,
	[DelColumn] [char] (1)  NULL ,
	[WebCHK] [char] (1)  NULL ,
	[dateInsertTime] [smalldatetime] NULL CONSTRAINT [DF__TblCRM_SE__dateI__03BB8E22] DEFAULT (getdate())
) 
GO

CREATE TABLE dbo.[TblCurrentUser] (
	[strClientID] [varchar] (20)  NOT NULL ,
	[UID] [int] NOT NULL ,
	[intCRMIndex] [int] NOT NULL ,
	[strIP] [varchar] (15)  NOT NULL ,
	[strBillingType] [char] (1)  NOT NULL ,
	[tinyServerID] [tinyint] NOT NULL ,
	[dateLoginTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblCurren__dateL__7D0E9093] DEFAULT (getdate()),
	[FirstLoginTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblCurren__First__7E02B4CC] DEFAULT (getdate()),
	CONSTRAINT [PK_TblCurrentUser] PRIMARY KEY  NONCLUSTERED 
	(
		[strClientID]
	) WITH  FILLFACTOR = 90   
) 
GO

CREATE TABLE dbo.[TblCurrentUser_Disconn] (
	[strClientID] [varchar] (20)  NOT NULL ,
	[UID] [int] NOT NULL ,
	[ServerID] [int] NOT NULL ,
	[strCommand] [char] (2)  NOT NULL 
) 
GO

CREATE TABLE dbo.[TblCurrentUser_Temp] (
	[strClientID] [varchar] (20)  NOT NULL ,
	[UID] [int] NOT NULL ,
	[intCRMIndex] [int] NOT NULL ,
	[strIP] [varchar] (15)  NOT NULL ,
	[strBillingType] [char] (1)  NOT NULL ,
	[tinyServerID] [tinyint] NOT NULL ,
	[dateLoginTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblCurren__dateL__00DF2177] DEFAULT (getdate()),
	CONSTRAINT [PK_TblCurrentUser_TEMP] PRIMARY KEY  NONCLUSTERED 
	(
		[strClientID]
	) WITH  FILLFACTOR = 90   
) 
GO

CREATE TABLE dbo.[TblImportedNum] (
	[strCompType] [char] (1)  NULL ,
	[intCount] [int] NULL 
) 
GO


CREATE TABLE dbo.[TblPCRoomBillingInfo] (
	[intCRMIndex] [int] NOT NULL ,
	[strCRMCode] [varchar] (20)  NOT NULL ,
	[strBillingType] [char] (1)  NOT NULL ,
	[dateRegTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblPCRoom__dateR__6BE40491] DEFAULT (getdate()),
	CONSTRAINT [PK_TblPCRoomBillingInfo] PRIMARY KEY  CLUSTERED 
	(
		[strCRMCode],
		[strBillingType]
	) WITH  FILLFACTOR = 90   ,
	 UNIQUE  NONCLUSTERED 
	(
		[intCRMIndex]
	) WITH  FILLFACTOR = 90   ,
	 CHECK ([strBillingType] = 'T' or [strBillingType] = 'D')
) 
GO

CREATE TABLE dbo.[TblGameRoomIPList] (
	[intCRMIndex] [int] NOT NULL ,
	[strIP] [varchar] (15)  NOT NULL ,
	CONSTRAINT [pk_TblGameRoomIPList] PRIMARY KEY  CLUSTERED 
	(
		[intCRMIndex],
		[strIP]
	) WITH  FILLFACTOR = 90   ,
	CONSTRAINT [FK_TblGameRoomIPList_intCRMIndex] FOREIGN KEY 
	(
		[intCRMIndex]
	) REFERENCES [TblPCRoomBillingInfo] (
		[intCRMIndex]
	)
) 

GO

CREATE TABLE dbo.[TblPCRoomBilling_Date] (
	[intCRMIndex] [int] NOT NULL ,
	[strRegProcess] [char] (1)  NOT NULL ,
	[dateStartTime] [smalldatetime] NOT NULL ,
	[dateEndTime] [smalldatetime] NOT NULL ,
	[tinyServiceIpNum] [tinyint] NOT NULL ,
	[tinyUsedIpNum] [tinyint] NOT NULL CONSTRAINT [DF__TblPCRoom__tinyU__6EC0713C] DEFAULT (0),
	[strClosed] [char] (1)  NOT NULL CONSTRAINT [DF__TblPCRoom__strCl__70A8B9AE] DEFAULT ('N'),
	 PRIMARY KEY  NONCLUSTERED 
	(
		[intCRMIndex]
	) WITH  FILLFACTOR = 90   ,
	CONSTRAINT [FK_TblPCRoomBillingInfo_Date_intCRMIndex] FOREIGN KEY 
	(
		[intCRMIndex]
	) REFERENCES [TblPCRoomBillingInfo] (
		[intCRMIndex]
	),
	 CHECK ([tinyUsedIpNum] >= 0)
) 
GO

CREATE TABLE dbo.[TblPCRoomBilling_Time] (
	[intCRMIndex] [int] NOT NULL ,
	[strRegProcess] [char] (1)  NOT NULL ,
	[intServiceTime] [int] NOT NULL ,
	[intUsingTime] [int] NOT NULL CONSTRAINT [DF__TblPCRoom__intUs__74794A92] DEFAULT (0),
	[dateStartTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblPCRoom__dateS__756D6ECB] DEFAULT (getdate()),
	[strClosed] [char] (1)  NOT NULL CONSTRAINT [DF__TblPCRoom__strCl__76619304] DEFAULT ('N'),
	 PRIMARY KEY  NONCLUSTERED 
	(
		[intCRMIndex]
	) WITH  FILLFACTOR = 90   ,
	CONSTRAINT [FK_TblPCRoomBillingInfo_Time_intCRMIndex] FOREIGN KEY 
	(
		[intCRMIndex]
	) REFERENCES [TblPCRoomBillingInfo] (
		[intCRMIndex]
	)
) 
GO

CREATE TABLE dbo.[TblPersonBilling_log] (
	[intIndex] [int] NULL ,
	[strClientID] [varchar] (20)  NULL ,
	[UID] [int] NULL ,
	[strBillingType] [char] (1)  NULL ,
	[dateEndTime] [smalldatetime] NULL ,
	[intServiceTime] [int] NULL ,
	[strConvertCHK] [char] (1)  NULL ,
	[dateInsertTime] [smalldatetime] NULL ,
	 CHECK ([strBillingType] = 'T' or [strBillingType] = 'D')
) 
GO
CREATE TABLE dbo.[TblPersonBillingInfo] (
	[strClientID] [varchar] (20)  NOT NULL ,
	[UID] [int] NOT NULL ,
	[dateEndTime] [smalldatetime] NULL ,
	[intServiceTime] [int] NULL ,
	[intUsingTime] [int] NULL ,
	[dateRegTime] [smalldatetime] NOT NULL ,
	 PRIMARY KEY  NONCLUSTERED 
	(
		[strClientID]
	) WITH  FILLFACTOR = 90   
) 
GO
CREATE TABLE dbo.[TblPersonInfo] (
	[UID] [int] NOT NULL ,
	[strClientID] [varchar] (20)  NOT NULL ,
	[RegLoginTime] [smalldatetime] NOT NULL ,
	[LastLogOutTime] [smalldatetime] NOT NULL ,
	 PRIMARY KEY  NONCLUSTERED 
	(
		[UID]
	) WITH  FILLFACTOR = 90   
) 
GO

CREATE TABLE dbo.[TblRestraintChar] (
	[tinyServerID] [tinyint] NOT NULL ,
	[UID] [int] NOT NULL ,
	[strClientID] [varchar] (20)  NOT NULL ,
	[strCharName] [varchar] (20)  NOT NULL CONSTRAINT [DF__TblRestra__strCh__11158940] DEFAULT ('ACCOUNT'),
	[tinyType] [tinyint] NOT NULL ,
	[tinyKind] [tinyint] NOT NULL ,
	[tinyBlocked] [tinyint] NOT NULL ,
	[dateStartTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblRestra__dateS__1209AD79] DEFAULT (getdate()),
	[dateEndTime] [smalldatetime] NOT NULL ,
	[intEndTime] [int] NOT NULL CONSTRAINT [DF__TblRestra__intEn__12FDD1B2] DEFAULT (0),
	[strAdminID] [varchar] (20)  NULL ,
	[strDescription] [varchar] (30)  NULL 
) 
GO


-- LOCATION  DBNAME : RYLBillingDB_LOG

CREATE TABLE dbo.[TblCRM_RYLLOG_LOG] (
	[intIndex] [int] NULL ,
	[strCRMCode] [varchar] (15)  NULL ,
	[strPriceType] [char] (1)  NULL ,
	[dateSysDay] [smalldatetime] NULL ,
	[strCommand] [char] (1)  NULL ,
	[strCRMIP1] [varchar] (12)  NULL ,
	[strStartCRMIP1] [tinyint] NULL ,
	[strEndCRMIP1] [tinyint] NULL ,
	[strCRMIP2] [varchar] (12)  NULL ,
	[strStartCRMIP2] [tinyint] NULL ,
	[strEndCRMIP2] [tinyint] NULL ,
	[strCRMIP3] [varchar] (12)  NULL ,
	[strStartCRMIP3] [tinyint] NULL ,
	[strEndCRMIP3] [tinyint] NULL ,
	[strTimeprocess] [char] (1)  NULL ,
	[intServiceTime] [int] NULL ,
	[dateServiceDay] [smalldatetime] NULL ,
	[TinyServiceIPNum] [tinyint] NULL ,
	[dateEndday] [smalldatetime] NULL ,
	[intEndTime] [int] NULL ,
	[strRYLCHK] [char] (1)  NULL ,
	[strConvertCHK] [char] (1)  NULL 
) 
GO


CREATE TABLE dbo.[TblCRM_SERVICETIME_LOG] (
	[strCRMCode] [varchar] (20)  NULL ,
	[intServiceTime] [int] NULL ,
	[DelColumn] [char] (1)  NULL ,
	[dateInsertTime] [smalldatetime] NULL 
) 
GO

CREATE TABLE dbo.[TblCurrentUser_Log] (
	[strClientid] [varchar] (20)  NULL ,
	[UID] [int] NULL ,
	[intCRMIndex] [int] NULL ,
	[strIp] [varchar] (15)  NULL ,
	[strBillingType] [char] (1)  NULL ,
	[tinyServerID] [tinyint] NULL ,
	[FirstLoginTime] [smalldatetime] NULL ,
	[LoginTime] [smalldatetime] NULL ,
	[LogoutTime] [smalldatetime] NULL ,
	[intPlayTime] [int] NULL 
) 
GO

CREATE TABLE dbo.[TblGameRoomIPList_DELLOG] (
	[intCRMIndex] [int] NULL ,
	[strIP] [varchar] (15)  NULL 
) 
GO


CREATE TABLE dbo.[TblPCRoomBilling_Date_DELLOG] (
	[intCRMIndex] [int] NULL ,
	[strRegProcess] [char] (1)  NULL ,
	[dateStartTime] [smalldatetime] NULL ,
	[dateEndTime] [smalldatetime] NULL ,
	[tinyServiceIpNum] [tinyint] NULL ,
	[tinyUsedIpNum] [tinyint] NULL ,
	[strClosed] [char] (1)  NULL 
) 
GO

CREATE TABLE dbo.[TblPCRoomBillingInfo_DELLOG] (
	[intCRMIndex] [int] NULL ,
	[strCRMCode] [varchar] (20)  NULL ,
	[strBillingType] [char] (1)  NULL ,
	[dateRegTime] [smalldatetime] NULL 
) 
GO

CREATE TABLE dbo.[TblPersonBilling_log_History] (
	[intIndex] [int] NULL ,
	[strClientID] [varchar] (20)  NULL ,
	[UID] [int] NULL ,
	[strBillingType] [char] (1)  NULL ,
	[dateEndTime] [smalldatetime] NULL ,
	[intServiceTime] [int] NULL ,
	[strConvertCHK] [char] (1)  NULL ,
	[dateInsertTime] [smalldatetime] NULL 
) 
GO
