/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MFTREPORTSUMMARY' AND KSQL_COL_NAME ='FDAILYEXPTYPE')
 ALTER TABLE T_POM_MFTREPORTSUMMARY ADD (FDAILYEXPTYPE BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MFTREPORTSUMMARY' AND KSQL_COL_NAME ='FTASKTYPE') 
 ALTER TABLE T_POM_MFTREPORTSUMMARY ADD (FTASKTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MFTREPORTER' AND KSQL_COL_NAME ='FPROFESSIONA')
  ALTER TABLE T_POM_MFTREPORTER ADD (FPROFESSIONA BIGINT DEFAULT 0 NOT NULL);
  
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_TRANSTYPECODERULE' AND KSQL_COL_NAME ='FLSHLENGTH') 
 ALTER TABLE T_POM_TRANSTYPECODERULE ADD (FLSHLENGTH BIGINT DEFAULT 4 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MULEXECONDITION') 
 CREATE TABLE T_POM_MULEXECONDITION (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);
 EXEC P_ALTERPK 'PK_POM_MULEXECONDITION', 'T_POM_MULEXECONDITION', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MULEXECONDITION_FK') CREATE INDEX IDX_POM_MULEXECONDITION_FK ON T_POM_MULEXECONDITION ( FENTRYID );
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/
