/**Begin D:\git\pdm\pdm_upgrade\PDM1\ER_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_ER_INVOICEASYNCLOG', 'T_ER_INVOICEASYNCLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_INVLOG_STATUS') CREATE INDEX IDX_ER_INVLOG_STATUS ON T_ER_INVOICEASYNCLOG ( FREQSTATUS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_INVLOG_TIME') CREATE INDEX IDX_ER_INVLOG_TIME ON T_ER_INVOICEASYNCLOG ( FREQTIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_INVLOG_BIZOBJ') CREATE INDEX IDX_ER_INVLOG_BIZOBJ ON T_ER_INVOICEASYNCLOG ( FBIZOBJID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_INVLOG_BILLOPER') CREATE INDEX IDX_ER_INVLOG_BILLOPER ON T_ER_INVOICEASYNCLOG ( FBILLOPERID );

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


 EXEC P_ALTERPK 'PK_T_ER_OPERATION', 'T_ER_OPERATION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_ER_OPERATION') CREATE INDEX IDX_T_ER_OPERATION ON T_ER_OPERATION ( FPLUGIN );


 EXEC P_ALTERPK 'PK_ER_OPERATION_L', 'T_ER_OPERATION_L', 'FPKID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_OPERATION_L') CREATE UNIQUE  CLUSTERED INDEX IDX_ER_OPERATION_L ON T_ER_OPERATION_L ( FID ,FLOCALEID );



/**End D:\git\pdm\pdm_upgrade\PDM1\ER_constraint.sql **/
