 /** 权限部分表格原先放在hbss，因地铁新执行顺序问题，必须移到hrcs **/
 
 
 
 
 EXEC P_ALTERPK 'PK_HBSS_PERMORGENTRY', 'T_HBSS_PERMORGENTRY', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_PERMORGENTRY_FUSERID') CREATE INDEX IDX_HBSS_PERMORGENTRY_FUSERID ON T_HBSS_PERMORGENTRY ( FUSERID ,FSTATUS ,FADMINORGID ,FCONTAINSSUB );


 EXEC P_ALTERPK 'PK_HBSS_PERMFILEGRPMEMBER', 'T_HBSS_PERMFILEGRPMEMBER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_PERMFILEGRPMEMBER') CREATE INDEX IDX_HBSS_PERMFILEGRPMEMBER ON T_HBSS_PERMFILEGRPMEMBER ( FGROUPID ,FPERMFILEID );


 EXEC P_ALTERPK 'PK_HBSS_ROLEEMPGRPPERM', 'T_HBSS_ROLEEMPGRPPERM', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ROLEEMPGRPPERM') CREATE INDEX IDX_HBSS_ROLEEMPGRPPERM ON T_HBSS_ROLEEMPGRPPERM ( FROLEID ,FPERMFILEID );


 EXEC P_ALTERPK 'PK_HBSS_ROLEORGEXCLUDE', 'T_HBSS_ROLEORGEXCLUDE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ORGEXCLUDE') CREATE INDEX IDX_HBSS_ORGEXCLUDE ON T_HBSS_ROLEORGEXCLUDE ( FID ,FORGID );


 EXEC P_ALTERPK 'PK_HBSS_PERMROLE', 'T_HBSS_PERMROLE', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_PERMROLEGRP', 'T_HBSS_PERMROLEGRP', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_PERMFILEGRP', 'T_HBSS_PERMFILEGRP', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_PERMFILES_L', 'T_HBSS_PERMFILES_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_PERMFILES', 'T_HBSS_PERMFILES', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_PERMFILES_USER') CREATE INDEX IDX_HBSS_PERMFILES_USER ON T_HBSS_PERMFILES ( FUSERID ,FENABLE );


 EXEC P_ALTERPK 'PK_HBSS_PERMFILEGRP_L', 'T_HBSS_PERMFILEGRP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_ROLEORG', 'T_HBSS_ROLEORG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ROLEORG') CREATE INDEX IDX_HBSS_ROLEORG ON T_HBSS_ROLEORG ( FROLEID );


 EXEC P_ALTERPK 'PK_HBSS_PERMROLEGRP_L', 'T_HBSS_PERMROLEGRP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_ROLEBUCAFUNC', 'T_HBSS_ROLEBUCAFUNC', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ROLEBUCAFUNC') CREATE INDEX IDX_HBSS_ROLEBUCAFUNC ON T_HBSS_ROLEBUCAFUNC ( FROLEID );


 EXEC P_ALTERPK 'PK_HBSS_HRROLEBU', 'T_HBSS_HRROLEBU', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_ROLEBUEXT', 'T_HBSS_ROLEBUEXT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_ROLEBUEXT') CREATE INDEX IDX_HBSS_ROLEBUEXT ON T_HBSS_ROLEBUEXT ( FUSERROLEID );


 EXEC P_ALTERPK 'PK_HBSS_USERROLE', 'T_HBSS_USERROLE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_USERROLE') CREATE INDEX IDX_HBSS_USERROLE ON T_HBSS_USERROLE ( FPERMFILEID );


 EXEC P_ALTERPK 'PK_HBSS_PERMAUTHCONFIG_L', 'T_HBSS_PERMAUTHCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HBSS_PERMAUTHCONFIG', 'T_HBSS_PERMAUTHCONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_PERMAUTHCONFIG') CREATE INDEX IDX_HBSS_PERMAUTHCONFIG ON T_HBSS_PERMAUTHCONFIG ( FENTITYNUMBER );


 EXEC P_ALTERPK 'PK_HBSS_PERMF7IGNORE', 'T_HBSS_PERMF7IGNORE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HBSS_PERMF7IGNORE') CREATE INDEX IDX_HBSS_PERMF7IGNORE ON T_HBSS_PERMF7IGNORE ( FENTITYNUMBER ,FBDPROPKEY );


 