/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_EXPERTSCHEME') 
 CREATE TABLE T_SRC_EXPERTSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISSYSPRESET BIGINT DEFAULT 0 NOT NULL,
FCONDITION NVARCHAR(510) DEFAULT ' ' NOT NULL,
FCONDITION_TAG NCLOB,
FBASEDATAID VARCHAR(36) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATCHFIELD INT DEFAULT 0 NOT NULL,
FFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDID VARCHAR(30) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_EXPERTSCHEMEENTRY') 
 CREATE TABLE T_SRC_EXPERTSCHEMEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPLUGINNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FDISPLAYFIELDS NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST' AND KSQL_COL_NAME ='FCONDITION') 
 ALTER TABLE T_SRC_PURLIST ADD (FCONDITION NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SUPSCHEMEENTRY' AND KSQL_COL_NAME ='FDISPLAYFIELDS') 
 ALTER TABLE T_SRC_SUPSCHEMEENTRY ADD (FDISPLAYFIELDS NVARCHAR(500) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SRC_table.sql **/
