/**Begin D:\PDM_UPGRADE\PDM1\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USER' AND KSQL_COL_NAME ='FIDTYPE') 
 ALTER TABLE T_SEC_USER ADD (FIDTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USER_H' AND KSQL_COL_NAME ='FIDTYPE') 
 ALTER TABLE T_SEC_USER_H ADD (FIDTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_STANDDEVCONFIG' AND KSQL_COL_NAME ='FSTATUS') 
 ALTER TABLE T_LIC_STANDDEVCONFIG ADD (FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_STANDDEVCONFIG' AND KSQL_COL_NAME ='FCREATORID') 
 ALTER TABLE T_LIC_STANDDEVCONFIG ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_STANDDEVCONFIG' AND KSQL_COL_NAME ='FCREATETIME') 
 ALTER TABLE T_LIC_STANDDEVCONFIG ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_STANDDEVCONFIG' AND KSQL_COL_NAME ='FMODIFYTIME') 
 ALTER TABLE T_LIC_STANDDEVCONFIG ADD (FMODIFYTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LIC_STANDDEVCONFIG' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_LIC_STANDDEVCONFIG ADD (FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_LIC_STANDDEVCONFIG_BACK') 
 CREATE TABLE T_LIC_STANDDEVCONFIG_BACK (
FID BIGINT DEFAULT 0 NOT NULL,
FBIZAPPID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTITYTYPEID VARCHAR(36) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_TENANT') 
 CREATE TABLE T_CTSY_TENANT (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FCONNECTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FSERVERIP VARCHAR(200) DEFAULT ' ' NOT NULL,
FSERVERPORT VARCHAR(30) DEFAULT ' ' NOT NULL,
FACCOUNTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTENANTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPSECRET VARCHAR(200) DEFAULT ' ' NOT NULL,
FUSER VARCHAR(30) DEFAULT ' ' NOT NULL,
FPWD VARCHAR(200) DEFAULT ' ' NOT NULL,
FISCLINKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FTENANTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FWEBAPP VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATE VARCHAR(30) DEFAULT ' ' NOT NULL,
FACCOUNTNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDEPLOYSTATE VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_TENANT_L') 
 CREATE TABLE T_CTSY_TENANT_L (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_BASEDATA') 
 CREATE TABLE T_CTSY_BASEDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FBASEDATAFIELD VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_BASEDATA_L') 
 CREATE TABLE T_CTSY_BASEDATA_L (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_DISTRIBUTSCHEME') 
 CREATE TABLE T_CTSY_DISTRIBUTSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FISCDATAID BIGINT DEFAULT 0 NOT NULL,
FTRACEALL CHAR(1) DEFAULT '0' NOT NULL,
FSCHEDULESWITCH CHAR(1) DEFAULT '0' NOT NULL,
FINTERVAL VARCHAR(30) DEFAULT ' ' NOT NULL,
FSCHEDULE VARCHAR(30) DEFAULT ' ' NOT NULL,
FVALIDATEDTIME DATETIME,
FEXPIREDTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_DISTRIBUTSCHEME_L') 
 CREATE TABLE T_CTSY_DISTRIBUTSCHEME_L (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_TENANTORGRELATION') 
 CREATE TABLE T_CTSY_TENANTORGRELATION (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTYPE NVARCHAR(30) DEFAULT '0' NOT NULL,
FTENANTID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_DISTSCHEMETENANTS') 
 CREATE TABLE T_CTSY_DISTSCHEMETENANTS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
FISCTRIGGERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_DISTSCHEMEFILTERS') 
 CREATE TABLE T_CTSY_DISTSCHEMEFILTERS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FLEFTBRACKET VARCHAR(30) DEFAULT ' ' NOT NULL,
FFILTERCOLUMN VARCHAR(150) DEFAULT ' ' NOT NULL,
FFILTERLABEL VARCHAR(150) DEFAULT ' ' NOT NULL,
FCOMPARE VARCHAR(30) DEFAULT ' ' NOT NULL,
FVALUEFIXED NVARCHAR(255) DEFAULT ' ' NOT NULL,
FRIGHTBRACKET VARCHAR(30) DEFAULT ' ' NOT NULL,
FLINK VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_CTSY_DISTTRIGGERS') 
 CREATE TABLE T_CTSY_DISTTRIGGERS (
FID BIGINT DEFAULT 0 NOT NULL,
FDISTID BIGINT DEFAULT 0 NOT NULL,
FTRIGGERTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FTENANTID BIGINT DEFAULT 0 NOT NULL,
FISCDATAID BIGINT DEFAULT 0 NOT NULL,
FTRIGGERID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME
);



/**End D:\PDM_UPGRADE\PDM1\BOS_table.sql **/
