/**Begin D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HRCS_constraint.sql **/
 EXEC P_ALTERPK 'PK_HRCS_APISOURCE', 'T_HRCS_APISOURCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_APISOURCE') CREATE INDEX IDX_HRCS_APISOURCE ON T_HRCS_APISOURCE ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_APISOURCE_L', 'T_HRCS_APISOURCE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_APISOURCE_L') CREATE INDEX IDX_HRCS_APISOURCE_L ON T_HRCS_APISOURCE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_APISOURCE_A', 'T_HRCS_APISOURCE_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_APISOURCE_A') CREATE INDEX IDX_HRCS_APISOURCE_A ON T_HRCS_APISOURCE_A ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_APIENTITY', 'T_HRCS_APIENTITY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_APIFIELD', 'T_HRCS_APIFIELD', 'FAPIFIELDID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_APIINPUT', 'T_HRCS_APIINPUT', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_APIINPUT_L', 'T_HRCS_APIINPUT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_APIINPUT_L') CREATE INDEX IDX_HRCS_APIINPUT_L ON T_HRCS_APIINPUT_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_APIOUTPUT', 'T_HRCS_APIOUTPUT', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_APIOUTPUT_L', 'T_HRCS_APIOUTPUT_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_APIOUTPUT_L') CREATE INDEX IDX_HRCS_APIOUTPUT_L ON T_HRCS_APIOUTPUT_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGCENTER', 'T_HRCS_MSGCENTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGCENTER') CREATE INDEX IDX_HRCS_MSGCENTER ON T_HRCS_MSGCENTER ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGCENTER_L', 'T_HRCS_MSGCENTER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGCENTER_L') CREATE INDEX IDX_HRCS_MSGCENTER_L ON T_HRCS_MSGCENTER_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGCENTERENTRY', 'T_HRCS_MSGCENTERENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_MSGPROBO', 'T_HRCS_MSGPROBO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPROBO') CREATE INDEX IDX_HRCS_MSGPROBO ON T_HRCS_MSGPROBO ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGPROBO_L', 'T_HRCS_MSGPROBO_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPROBO_L') CREATE INDEX IDX_HRCS_MSGPROBO_L ON T_HRCS_MSGPROBO_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLISHER', 'T_HRCS_MSGPUBLISHER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBLISHER') CREATE INDEX IDX_HRCS_MSGPUBLISHER ON T_HRCS_MSGPUBLISHER ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLISHER_L', 'T_HRCS_MSGPUBLISHER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBLISHER_L') CREATE INDEX IDX_HRCS_MSGPUBLISHER_L ON T_HRCS_MSGPUBLISHER_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_SUBBSIFIELD', 'T_HRCS_SUBBSIFIELD', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_SUBBSIFIELD') CREATE INDEX IDX_HRCS_SUBBSIFIELD ON T_HRCS_SUBBSIFIELD ( FID ,FBASEDATAID );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLISHAPI', 'T_HRCS_MSGPUBLISHAPI', 'FPUBAPIID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLISHAPI_L', 'T_HRCS_MSGPUBLISHAPI_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBLISHAPI_L') CREATE INDEX IDX_HRCS_MSGPUBLISHAPI_L ON T_HRCS_MSGPUBLISHAPI_L ( FPUBAPIID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBSCRIBER', 'T_HRCS_MSGSUBSCRIBER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBSCRIBER') CREATE INDEX IDX_HRCS_MSGSUBSCRIBER ON T_HRCS_MSGSUBSCRIBER ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBSCRIBER_L', 'T_HRCS_MSGSUBSCRIBER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBSCRIBER_L') CREATE INDEX IDX_HRCS_MSGSUBSCRIBER_L ON T_HRCS_MSGSUBSCRIBER_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBSCRIBEAPI', 'T_HRCS_MSGSUBSCRIBEAPI', 'FSUBSCRIBEAPIID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBSCRIBEAPI_L', 'T_HRCS_MSGSUBSCRIBEAPI_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBSCRIBEAPI_L') CREATE INDEX IDX_HRCS_MSGSUBSCRIBEAPI_L ON T_HRCS_MSGSUBSCRIBEAPI_L ( FSUBSCRIBEAPIID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLOG', 'T_HRCS_MSGPUBLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBLOG') CREATE INDEX IDX_HRCS_MSGPUBLOG ON T_HRCS_MSGPUBLOG ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBLOG_L', 'T_HRCS_MSGPUBLOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBLOG_L') CREATE INDEX IDX_HRCS_MSGPUBLOG_L ON T_HRCS_MSGPUBLOG_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MODIFYITEMLOG', 'T_HRCS_MODIFYITEMLOG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_MODIFYITEMLOG_L', 'T_HRCS_MODIFYITEMLOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MODIFYITEMLOG_L') CREATE INDEX IDX_HRCS_MODIFYITEMLOG_L ON T_HRCS_MODIFYITEMLOG_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBAPILOG', 'T_HRCS_MSGPUBAPILOG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HRCS_MSGPUBAPILOG_L', 'T_HRCS_MSGPUBAPILOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGPUBAPILOG_L') CREATE INDEX IDX_HRCS_MSGPUBAPILOG_L ON T_HRCS_MSGPUBAPILOG_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBLOGENTRY', 'T_HRCS_MSGSUBLOGENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBLOGENTRY') CREATE INDEX IDX_HRCS_MSGSUBLOGENTRY ON T_HRCS_MSGSUBLOGENTRY ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBLOGENTRY_L', 'T_HRCS_MSGSUBLOGENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBLOGENTRY_L') CREATE INDEX IDX_HRCS_MSGSUBLOGENTRY_L ON T_HRCS_MSGSUBLOGENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBLOG', 'T_HRCS_MSGSUBLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBLOG') CREATE INDEX IDX_HRCS_MSGSUBLOG ON T_HRCS_MSGSUBLOG ( FNUMBER );


 EXEC P_ALTERPK 'PK_HRCS_MSGSUBLOG_L', 'T_HRCS_MSGSUBLOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGSUBLOG_L') CREATE INDEX IDX_HRCS_MSGSUBLOG_L ON T_HRCS_MSGSUBLOG_L ( FID ,FLOCALEID );

-- 增加索引
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_MSGCENTER_SENDTIME') CREATE INDEX IDX_HRCS_MSGCENTER_SENDTIME ON T_HRCS_MSGCENTER ( FSENDTIME );


/**End D:\utils\PDM_UPGRADE\PDM_UPGRADE\PDM1\HRCS_constraint.sql **/
