/**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_POM_XMFTORDERMLOG_XBILLID') CREATE INDEX IDX_POM_XMFTORDERMLOG_XBILLID ON T_POM_XMFTORDERMLOG ( FXBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROSWS_SRCBILLID') CREATE INDEX IDX_POM_MROSWS_SRCBILLID ON T_POM_MROSWS ( FSRCBILLID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROSWS_CREATETIME') CREATE INDEX IDX_POM_MROSWS_CREATETIME ON T_POM_MROSWS ( FCREATETIME );

EXEC p_DropIdx 'IDX_MROORDERENTRY_FTRACKID', 'T_POM_MROORDERENTRY';
EXEC p_DropIdx 'IDX_MROORDERENTRY_FCFGCODEID', 'T_POM_MROORDERENTRY';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDERENTRY_PROJECTID') CREATE INDEX IDX_MROORDERENTRY_PROJECTID ON T_POM_MROORDERENTRY ( FPROJECTID );

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDERENTRY_CARDID') CREATE INDEX IDX_MROORDERENTRY_CARDID ON T_POM_MROORDERENTRY ( FWORKCARDID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDERENTRY_CUSTID') CREATE INDEX IDX_MROORDERENTRY_CUSTID ON T_POM_MROORDERENTRY ( FCUSTOMERID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_XMFTORDERENTRY_ORG') CREATE INDEX IDX_XMFTORDERENTRY_ORG ON T_POM_XMFTORDERENTRY_S ( FORGID );

EXEC p_DropIdx 'IDX_POM_MROSTOCK_FSOURCEBILLID', 'T_POM_MROSTOCK';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCK_ORGFID') CREATE INDEX IDX_MROSTOCK_ORGFID ON T_POM_MROSTOCK ( FCREATETIME ,FORGID );

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCK_FBILLNO') CREATE INDEX IDX_MROSTOCK_FBILLNO ON T_POM_MROSTOCK ( FBILLNO ,FORDERNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCK_FWORKCARDID') CREATE INDEX IDX_MROSTOCK_FWORKCARDID ON T_POM_MROSTOCK ( FWORKCARDID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCK_FPJCUSTOMER') CREATE INDEX IDX_MROSTOCK_FPJCUSTOMER ON T_POM_MROSTOCK ( FPROJECTID ,FCUSTOMER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCKEN_FID') CREATE INDEX IDX_MROSTOCKEN_FID ON T_POM_MROSTOCKENTRY ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROSTOCKEN_MFTID') CREATE INDEX IDX_MROSTOCKEN_MFTID ON T_POM_MROSTOCKENTRY ( FMATERIALID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MROORDER_CREATETIME') CREATE INDEX IDX_MROORDER_CREATETIME ON T_POM_MROORDER ( FCREATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_POM_MROORDER_ORGIDFID') CREATE INDEX IDX_POM_MROORDER_ORGIDFID ON T_POM_MROORDER ( FORGID );


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