/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_STOCKEN_MFTID') CREATE INDEX IDX_STOCKEN_MFTID ON T_POM_MANUSTOCKENTRY ( FMATERIALID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_STOCKEN_MID') CREATE INDEX IDX_STOCKEN_MID ON T_POM_MANUSTOCKENTRY ( FMATERIELMASTERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ORDEREN_MFTID') CREATE INDEX IDX_ORDEREN_MFTID ON T_POM_MFTORDERENTRY ( FMATERIAL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ORDEREN_MID') CREATE INDEX IDX_ORDEREN_MID ON T_POM_MFTORDERENTRY ( FMATERIELMASTERID );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MFTORDER_CREATETIME') CREATE INDEX IDX_MFTORDER_CREATETIME ON T_POM_MFTORDER ( FCREATETIME );

EXEC p_DropIdx 'IDX_POM_MOES_FORDERID', 'T_POM_MFTORDERENTRY_S';
EXEC p_DropIdx 'IDX_POM_MOES_FORDERENTRYID', 'T_POM_MFTORDERENTRY_S';
EXEC p_DropIdx 'IDX_POM_MOES_FSOURCEBILLID', 'T_POM_MFTORDERENTRY_S';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MOES_FORDERID') CREATE INDEX IDX_POM_MOES_FORDERID ON T_POM_MFTORDERENTRY_S ( FORDERID ,FORDERENTRYID ,FSOURCEBILLID ,FORDERNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MFTSTOCK_MFTID') CREATE INDEX IDX_MFTSTOCK_MFTID ON T_POM_MFTORDERENTRY_S ( FMATERIALID ,FPRODUCTMASTERID );


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