/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME IN ('FISBYPROJECT')) 
 ALTER TABLE T_SRC_PROJECT ADD (FISBYPROJECT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME IN ('FRATIO_SYN')) 
 ALTER TABLE T_SRC_PROJECT ADD (FRATIO_SYN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCORE' AND KSQL_COL_NAME IN ('FISAPTITUDE')) 
 ALTER TABLE T_SRC_SCORE ADD (FISAPTITUDE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCORE' AND KSQL_COL_NAME IN ('FISAPTITUDE2')) 
 ALTER TABLE T_SRC_SCORE ADD (FISAPTITUDE2 CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECTPACKAGE' AND KSQL_COL_NAME IN ('FISAPTOPEN')) 
 ALTER TABLE T_SRC_PROJECTPACKAGE ADD (FISAPTOPEN CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECTPACKAGE' AND KSQL_COL_NAME IN ('FAPTOPENDATE')) 
 ALTER TABLE T_SRC_PROJECTPACKAGE ADD (FAPTOPENDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECTPACKAGE' AND KSQL_COL_NAME IN ('FAPTOPENUSER')) 
 ALTER TABLE T_SRC_PROJECTPACKAGE ADD (FAPTOPENUSER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECTNODE' AND KSQL_COL_NAME IN ('FNODENAME')) 
 ALTER TABLE T_SRC_PROJECTNODE ADD (FNODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECTNODESUB' AND KSQL_COL_NAME IN ('FNODENAME')) 
 ALTER TABLE T_SRC_PROJECTNODESUB ADD (FNODENAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMEINDEX' AND KSQL_COL_NAME IN ('FSRCINDEXID')) 
 ALTER TABLE T_SRC_SCHEMEINDEX ADD (FSRCINDEXID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMEINDEX' AND KSQL_COL_NAME IN ('FISOPINION')) 
 ALTER TABLE T_SRC_SCHEMEINDEX ADD (FISOPINION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PROJECT_V') 
 CREATE TABLE T_SRC_PROJECT_V (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FBIZSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FSUPPLIERTYPE CHAR(1) DEFAULT '1' NOT NULL,
FAPTITUDETYPE CHAR(1) DEFAULT '1' NOT NULL,
FSUBMITTERID BIGINT DEFAULT 0 NOT NULL,
FSUBMITDATE DATETIME,
FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL,
FUNSUBMITDATE DATETIME,
FUNAUDITDATE DATETIME,
FUNAUDITORID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_APTITUDECONFIG2') 
 CREATE TABLE T_SRC_APTITUDECONFIG2 (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPACKAGEID BIGINT DEFAULT 0 NOT NULL,
FINDEXTYPEID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FTPLNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FEXPERTCOUNT INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_APTITUDERESULT2') 
 CREATE TABLE T_SRC_APTITUDERESULT2 (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSCORETASKID BIGINT DEFAULT 0 NOT NULL,
FINPUTSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FISAPTITUDE CHAR(1) DEFAULT '1' NOT NULL,
FAPTITUDENOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PROJECT_W') 
 CREATE TABLE T_SRC_PROJECT_W (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FBIZSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FSUBMITTERID BIGINT DEFAULT 0 NOT NULL,
FSUBMITDATE DATETIME,
FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL,
FUNSUBMITDATE DATETIME,
FUNAUDITDATE DATETIME,
FUNAUDITORID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL,
FLASTUPDATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SCORESUGGESTION') 
 CREATE TABLE T_SRC_SCORESUGGESTION (
FID BIGINT DEFAULT 0 NOT NULL,
FSCORERID BIGINT DEFAULT 0 NOT NULL,
FSCORETASKID BIGINT DEFAULT 0 NOT NULL,
FSCORERSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISVALID CHAR(1) DEFAULT '0' NOT NULL,
FSUGGESTION NVARCHAR(510) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SCHEMERULE') 
 CREATE TABLE T_SRC_SCHEMERULE (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FITEM NVARCHAR(510) DEFAULT ' ' NOT NULL,
FITEMVALUE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVALUEFROM DECIMAL(23,10) DEFAULT 0 NOT NULL,
FVALUETO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FITEMSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL
);



/**End C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
