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

/** IX_PERM_UPD_BIZ_ENT这个是历史的索引， IDX_PERM_UPDPEB 这个是已知的财务业务组产生的索引**/
EXEC p_DropIdx 'IX_PERM_UPD_BIZ_ENT', 'T_PERM_USERPERMDETAIL';
EXEC p_DropIdx 'IDX_PERM_UPDPEB', 'T_PERM_USERPERMDETAIL';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IX_PERM_UPD_BIZ_ENT') CREATE INDEX IX_PERM_UPD_BIZ_ENT ON T_PERM_USERPERMDETAIL ( FBIZAPPID ,FENTITYTYPEID ,FPERMITEMID );

EXEC p_DropIdx 'IX_PERM_RD_BIZ_ENT', 'T_PERM_ROLEPERMDETIAL';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_ROLEPERMDETIAL_ITEM') CREATE INDEX IDX_PERM_ROLEPERMDETIAL_ITEM ON T_PERM_ROLEPERMDETIAL ( FBIZAPPID ,FENTITYTYPEID ,FPERMITEMID );

EXEC p_DropIdx 'IDX_PERM_BIZROLEDISPERM_RP', 'T_PERM_BIZROLEDISPERM';
EXEC p_DropIdx 'IX_PERM_BDP_BIZ_ENT', 'T_PERM_BIZROLEDISPERM';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_BIZROLEDISPERM_RP') CREATE INDEX IDX_PERM_BIZROLEDISPERM_RP ON T_PERM_BIZROLEDISPERM ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IX_PERM_BDP_BIZ_ENT') CREATE INDEX IX_PERM_BDP_BIZ_ENT ON T_PERM_BIZROLEDISPERM ( FBIZAPPID ,FENTITYTYPEID ,FPERMITEMID );

EXEC p_DropIdx 'IDX_PERM_BIZROLEPERM_RP', 'T_PERM_BIZROLEPERM';
EXEC p_DropIdx 'IX_PERM_BP_BIZ_ENT', 'T_PERM_BIZROLEPERM';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_BIZROLEPERM_RP') CREATE INDEX IDX_PERM_BIZROLEPERM_RP ON T_PERM_BIZROLEPERM ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IX_PERM_BP_BIZ_ENT') CREATE INDEX IX_PERM_BP_BIZ_ENT ON T_PERM_BIZROLEPERM ( FBIZAPPID ,FENTITYTYPEID ,FPERMITEMID );

EXEC p_DropIdx 'IDX_PERM_DISFUNPERM', 'T_PERM_DISFUNPERM';
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_DISFUNPERM') CREATE INDEX IDX_PERM_DISFUNPERM ON T_PERM_DISFUNPERM ( FUSERID ,FORGID ,FBIZAPPID ,FENTITYTYPEID ,FPERMITEMID );


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