/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TASKSAVE' AND KSQL_COL_NAME ='FORGVIEWID') 
 ALTER TABLE T_EB_TASKSAVE ADD (FORGVIEWID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CHKATTACHMENT') 
 CREATE TABLE T_EB_CHKATTACHMENT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSUBFOLDER VARCHAR(500) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FSIZE INT DEFAULT 0 NOT NULL,
FUID VARCHAR(50) DEFAULT ' ' NOT NULL,
FATTYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CHKNOTEDETAIL') 
 CREATE TABLE T_EB_CHKNOTEDETAIL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FTYPE CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_CHKNOTEINFO') 
 CREATE TABLE T_EB_CHKNOTEINFO (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FDIMSTR VARCHAR(200) DEFAULT ' ' NOT NULL,
FDIMENSIONSUM INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECUTECASE') 
 CREATE TABLE T_EB_EXECUTECASE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FBUSINESSMODELID BIGINT DEFAULT 0 NOT NULL,
FRULEAMOUNT BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECUTECASERECORD') 
 CREATE TABLE T_EB_EXECUTECASERECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FCASENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCASENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEXECUTEPROGRESS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEAMOUNT BIGINT DEFAULT 0 NOT NULL,
FEXECUTERULEAMOUNT BIGINT DEFAULT 0 NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FLASTTIME DATETIME,
FCANCELOR BIGINT DEFAULT 0 NOT NULL,
FEXECUTESTATUS CHAR(1) DEFAULT '1' NOT NULL,
FEXECUTELOG NCLOB,
FMODELID BIGINT DEFAULT 0 NOT NULL
);


 EXEC p_AlterColumn 'T_EB_DIMSHAREMEMBER', 'FPARENTID', 'BIGINT', 'NOT NULL', '1111', '0';


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