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

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

--offer模版国家地区
EXEC P_ALTERPK 'PK_TSRBD_OFFERCOUNTRY', 'T_TSRBD_OFFERCOUNTRY', 'FPKID', '1';

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

--offer模版招聘场景
EXEC P_ALTERPK 'PK_TSRBD_OFFERRECRUSCENE', 'T_TSRBD_OFFERRECRUSCENE', 'FPKID', '1';

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

-- 招聘渠道start
EXEC P_ALTERPK 'PK_TSRBD_RECCOUNTRY', 'T_TSRBD_RECCOUNTRY', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_RECORG', 'T_TSRBD_RECORG', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_RECJOBLEVEL', 'T_TSRBD_RECJOBLEVEL', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_CHANNELCONTACT', 'T_TSRBD_CHANNELCONTACT', 'FID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_CHANNELCONTACT_L', 'T_TSRBD_CHANNELCONTACT_L', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_CHANNELCONTRACT', 'T_TSRBD_CHANNELCONTRACT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_TSRBD_CHANNELCONTRACT') CREATE INDEX IDX_TSRBD_CHANNELCONTRACT ON T_TSRBD_CHANNELCONTRACT ( FCONTRACTNUMBER );


EXEC P_ALTERPK 'PK_TSRBD_CHANNELCONTRACT_L', 'T_TSRBD_CHANNELCONTRACT_L', 'FPKID', '1';

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


EXEC P_ALTERPK 'PK_TSRBD_CHNLNCONTRACTORG', 'T_TSRBD_CHNLNCONTRACTORG', 'FPKID', '1';

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


-- 招聘渠道end
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TSRBD_constraint.sql **/
