/**Begin D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
--T_HDM_NEWROLEREL和T_HDM_OLDROLEREL两张表已经不用了,在kd_1.5.142_hdm_transfertable.sql脚本中已经drop该表,但是环境上不知道为什么还是执行出问题了,因此在此处直接注释

 --EXEC P_ALTERPK 'PK_HDM_NEWROLEREL', 'T_HDM_NEWROLEREL', 'FENTRYID', '1';

 --IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_HDM_NEWROLEREL') CREATE INDEX IDX_T_HDM_NEWROLEREL ON T_HDM_NEWROLEREL ( FBASEDATAID );


 --EXEC P_ALTERPK 'PK_HDM_OLDROLEREL', 'T_HDM_OLDROLEREL', 'FENTRYID', '1';

 --IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_OLDROLEREL') CREATE INDEX IDX_HDM_OLDROLEREL ON T_HDM_OLDROLEREL ( FBASEDATAID );


 EXEC P_ALTERPK 'PK_HDM_TRANSFERBILL', 'T_HDM_TRANSFERBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_FBILLNO') CREATE INDEX IDX_HDM_FBILLNO ON T_HDM_TRANSFERBILL ( FBILLNO );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_AFFRECORDID') CREATE INDEX IDX_HDM_AFFRECORDID ON T_HDM_TRANSFERBILL ( FAFFRECORDID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_ERMANFILEID') CREATE INDEX IDX_HDM_ERMANFILEID ON T_HDM_TRANSFERBILL ( FERMANFILEIFID );


 EXEC P_ALTERPK 'PK_HDM_TRANSFERBILL_A', 'T_HDM_TRANSFERBILL_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_TRANSFERBILL_A') CREATE INDEX IDX_HDM_TRANSFERBILL_A ON T_HDM_TRANSFERBILL_A ( FAREALITYORGID );


 EXEC P_ALTERPK 'PK_HDM_TRANSFERBILL_B', 'T_HDM_TRANSFERBILL_B', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_TRANSFERBILL_B') CREATE INDEX IDX_HDM_TRANSFERBILL_B ON T_HDM_TRANSFERBILL_B ( FREALITYDATE );


 EXEC P_ALTERPK 'PK_HDM_TRANSFERBILL_L', 'T_HDM_TRANSFERBILL_L', 'FPKID', '1';

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


 --EXEC P_ALTERPK 'PK_HDM_TRANSFERBILL_C', 'T_HDM_TRANSFERBILL_C', 'FID', '1';

 --IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HDM_TRANSFERBILL_C') CREATE INDEX IDX_HDM_TRANSFERBILL_C ON T_HDM_TRANSFERBILL_C ( FBCOMPANYHISNAME );


 EXEC P_ALTERPK 'PK_HDM_TRANSFERREASON_L', 'T_HDM_TRANSFERREASON_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_TRANSFERTERMREASON_L', 'T_HDM_TRANSFERTERMREASON_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_TRANSREVOKEREASON_L', 'T_HDM_TRANSREVOKEREASON_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_TRANSFERREASON', 'T_HDM_TRANSFERREASON', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_TRANSFERTERMREASON', 'T_HDM_TRANSFERTERMREASON', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HDM_TRANSREVOKEREASON', 'T_HDM_TRANSREVOKEREASON', 'FID', '1';

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



/**End D:\PDM_UPGRADE\PDM1\HDM_constraint.sql **/
