
/**Begin kd_1.5.97_eb_table_p7.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_VERSIONCOPYSCHEME')
CREATE TABLE T_EB_VERSIONCOPYSCHEME (
	FID BIGINT DEFAULT 0 NOT NULL,
	FBUSINESSMODEL BIGINT DEFAULT 0 NOT NULL,
	FSCHEMENAME NVARCHAR(50)  DEFAULT ' ' NOT NULL,
	FSCHEMETYPE NVARCHAR(50)  DEFAULT ' ' NOT NULL,
	FEFFECTIVEDATE DATETIME ,
	FEXPIRATIONDATE DATETIME ,
	FDATALOCK CHAR(1)  DEFAULT '1' NOT NULL,
	FSCHEMENUM NVARCHAR(50) DEFAULT ' '  NOT NULL,
	FBILLSTATUS NVARCHAR(50)  DEFAULT ' ' NOT NULL,
	FSRCVERSION BIGINT DEFAULT 0 NOT NULL,
	FTARVERSION BIGINT DEFAULT 0 NOT NULL,
	FMODIFIER BIGINT DEFAULT 0 NOT NULL,
	FMODIFYTIME DATETIME ,
	FMODEL BIGINT DEFAULT 0 NOT NULL,
	FCREATEDATE DATETIME ,
	FCREATER BIGINT DEFAULT 0 NOT NULL,
	FTEXTFIELD NVARCHAR(50)  DEFAULT ' ' NOT NULL,
	FPERIODSHOW NVARCHAR(50)  DEFAULT ' ' NOT NULL,
	FDATATYPESHOW NVARCHAR(50)  DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYSCHEMEPERIOD')
CREATE TABLE T_EB_COPYSCHEMEPERIOD (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT  DEFAULT 0 NOT NULL,
	FPERIOD BIGINT 
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYSCHEMESRCTRIAL')
CREATE TABLE T_EB_COPYSCHEMESRCTRIAL (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FSRCTRIAL BIGINT
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYSCHEMETARTRIAL')
CREATE TABLE T_EB_COPYSCHEMETARTRIAL (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FTARTRIAL BIGINT 
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYSCHEMEDATATYPE')
CREATE TABLE T_EB_COPYSCHEMEDATATYPE (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FDATATYPE BIGINT
);




/**BEGIN 版本复制记录 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FSRCVERSIONID') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FSRCVERSIONID BIGINT  DEFAULT 0 NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FTARVERSIONID') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FTARVERSIONID BIGINT  DEFAULT 0 NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FSCHEMENUM') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FSCHEMENUM NVARCHAR(50)  DEFAULT ' ' NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FSCHEMETYPE') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FSCHEMETYPE NVARCHAR(50)  DEFAULT ' ' NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FENTITYTEXT') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FENTITYTEXT NVARCHAR(50)  DEFAULT ' ' NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FSCHEMENAME') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FSCHEMENAME NVARCHAR(50) DEFAULT ' ' NOT NULL ;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FENTITYNUM') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FENTITYNUM NVARCHAR(50)  DEFAULT ' ' NOT NULL;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_VERSIONCOPYRECORD' AND KSQL_COL_NAME ='FBUSINESSMODEL') 
ALTER TABLE T_EB_VERSIONCOPYRECORD ADD FBUSINESSMODEL BIGINT;



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYRECORDDT')
CREATE TABLE T_EB_COPYRECORDDT (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FDATATYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYRECORDENTITY')
CREATE TABLE T_EB_COPYRECORDENTITY (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FENTITYID BIGINT ,
	FENTITY BIGINT 
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYRECORDP')
CREATE TABLE T_EB_COPYRECORDP (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FPERIODID BIGINT DEFAULT 0 NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_COPYRECORDTRIAL')
CREATE TABLE T_EB_COPYRECORDTRIAL (
	FID BIGINT DEFAULT 0 NOT NULL,
	FENTRYID BIGINT DEFAULT 0 NOT NULL,
	FSEQ BIGINT DEFAULT 0 NOT NULL,
	FTRIALID BIGINT DEFAULT 0 NOT NULL,
	FSOURCE CHAR(1) DEFAULT ' '  NOT NULL
);
/**end kd_1.5.97_eb_table_p7.sql **/