-- SMCSUPPORT-367: script from VD to create indexes on FKs in smclient and JBPM
-- 29.11.2013: SMAUDIT_MESSAGEID_IDX: La page des �l�ments effac�s doit v�rifi�s dans la table sM-Audit si le fichier avait �chou� pr�c�demment, de fa�on � afficher ou non la checkbox pour permettre l�effacement.

USE smclient;

-- SM-Client indexes

CREATE INDEX CONFIGURATION_DOMAIN_ID_IDX ON CONFIGURATION(DOMAIN_ID);
CREATE INDEX GROUPEDMESSAUDIT_MESSAGEID_IDX ON GROUPEDMESSAGEAUDIT(MESSAGE_ID);
CREATE INDEX MESSAGE_SEDEXID_IDX ON MESSAGE(SEDEXID);
CREATE INDEX SMAUDIT_SEDEXID_IDX ON SMAUDIT(SEDEXID);
CREATE INDEX SMAUDIT_MESSAGEID_IDX ON SMAUDIT(MESSAGE_ID);
CREATE INDEX SMUSER_SEDEXID_IDX ON SMUSER(SEDEXID);
CREATE INDEX SMUSER_SMROLE_ROLE_ID_IDX ON SMUSER_SMROLE(ROLE_ID);
CREATE INDEX SMUSER_SMROLE_SMUSER_ID_IDX ON SMUSER_SMROLE(SMUSER_ID);

-- JBPM indexes

create index IDX_ACTION_ACTNDL on JBPM_ACTION (ACTIONDELEGATION_);
create index IDX_ACTION_REFACT on JBPM_ACTION (REFERENCEDACTION_);
create index IDX_ACTION_PROCDF on JBPM_ACTION (PROCESSDEFINITION_);
create index IDX_ACTION_EVENT on JBPM_ACTION (EVENT_);
create index IDX_CRTETIMERACT_TA on JBPM_ACTION (TIMERACTION_);
create index IDX_COMMENT_TSK on JBPM_COMMENT (TASKINSTANCE_);
create index IDX_COMMENT_TOKEN on JBPM_COMMENT (TOKEN_);
create index IDX_DELEG_PRCD on JBPM_DELEGATION (PROCESSDEFINITION_);
create index IDX_JOB_TSKINST on JBPM_JOB (TASKINSTANCE_);
create index IDX_JOB_DUEDATE on JBPM_JOB (DUEDATE_);
create index IDX_JOB_ACTION on JBPM_JOB (ACTION_);
create index IDX_JOB_NODE on JBPM_JOB (NODE_);
create index IDX_JOB_TOKEN on JBPM_JOB (TOKEN_);
create index IDX_JOB_PRINST on JBPM_JOB (PROCESSINSTANCE_);
create index IDX_LOG_NEWBYTES on JBPM_LOG (NEWBYTEARRAY_);
create index IDX_LOG_OLDBYTES on JBPM_LOG (OLDBYTEARRAY_);
create index IDX_LOG_TASKINST on JBPM_LOG (TASKINSTANCE_);
create index IDX_LOG_SWIMINST on JBPM_LOG (SWIMLANEINSTANCE_);
create index IDX_LOG_TRANSITION on JBPM_LOG (TRANSITION_);
create index IDX_LOG_VARINST on JBPM_LOG (VARIABLEINSTANCE_);
create index IDX_LOG_PARENT on JBPM_LOG (PARENT_);
create index IDX_LOG_DESTNODE on JBPM_LOG (DESTINATIONNODE_);
create index IDX_LOG_NODE on JBPM_LOG (NODE_);
create index IDX_LOG_CHILDTOKEN on JBPM_LOG (CHILD_);
create index IDX_LOG_TOKEN on JBPM_LOG (TOKEN_);
create index IDX_LOG_ACTION on JBPM_LOG (ACTION_);
create index IDX_LOG_SOURCENODE on JBPM_LOG (SOURCENODE_);
create index IDX_MODDEF_PROCDF on JBPM_MODULEDEFINITION (PROCESSDEFINITION_);
create index IDX_TSKDEF_START on JBPM_MODULEDEFINITION (STARTTASK_);
create index IDX_MODINST_PRINST on JBPM_MODULEINSTANCE (PROCESSINSTANCE_);
create index IDX_TASKMGTINST_TMD on JBPM_MODULEINSTANCE (TASKMGMTDEFINITION_);
create index IDX_DECISION_DELEG on JBPM_NODE (DECISIONDELEGATION);
create index IDX_PSTATE_SBPRCDEF on JBPM_NODE (SUBPROCESSDEFINITION_);
create index IDX_NODE_PROCDEF on JBPM_NODE (PROCESSDEFINITION_);
create index IDX_NODE_SCRIPT on JBPM_NODE (SCRIPT_);
create index IDX_NODE_ACTION on JBPM_NODE (ACTION_);
create index IDX_NODE_SUPRSTATE on JBPM_NODE (SUPERSTATE_);
create index IDX_TSKINST_SWLANE on JBPM_POOLEDACTOR (SWIMLANEINSTANCE_);
create index IDX_PLDACTR_ACTID on JBPM_POOLEDACTOR (ACTORID_);
create index IDX_PROCDEF_STRTST on JBPM_PROCESSDEFINITION (STARTSTATE_);
create index IDX_PROCIN_SPROCTK on JBPM_PROCESSINSTANCE (SUPERPROCESSTOKEN_);
create index IDX_PROCIN_ROOTTK on JBPM_PROCESSINSTANCE (ROOTTOKEN_);
create index IDX_PROCIN_PROCDEF on JBPM_PROCESSINSTANCE (PROCESSDEFINITION_);
create index IDX_PROCIN_KEY on JBPM_PROCESSINSTANCE (KEY_);
create index IDX_RTACTN_ACTION on JBPM_RUNTIMEACTION (ACTION_);
create index IDX_RTACTN_PRCINST on JBPM_RUNTIMEACTION (PROCESSINSTANCE_);
create index IDX_SWL_ASSDEL on JBPM_SWIMLANE (ASSIGNMENTDELEGATION_);
create index IDX_SWL_TSKMGMTDEF on JBPM_SWIMLANE (TASKMGMTDEFINITION_);
create index IDX_SWIMLANEINST_TM on JBPM_SWIMLANEINSTANCE (TASKMGMTINSTANCE_);
create index IDX_SWIMLINST_SL on JBPM_SWIMLANEINSTANCE (SWIMLANE_);
create index IDX_TASK_PROCDEF on JBPM_TASK (PROCESSDEFINITION_);
create index IDX_TASK_SWIMLANE on JBPM_TASK (SWIMLANE_);
create index IDX_TASK_STARTST on JBPM_TASK (STARTSTATE_);
create index IDX_TSK_TSKCTRL on JBPM_TASK (TASKCONTROLLER_);
create index IDX_TASK_ASSDEL on JBPM_TASK (ASSIGNMENTDELEGATION_);
create index IDX_TASK_TSKNODE on JBPM_TASK (TASKNODE_);
create index IDX_TASK_TASKMGTDF on JBPM_TASK (TASKMGMTDEFINITION_);
create index IDX_TSKCTRL_DELEG on JBPM_TASKCONTROLLER (TASKCONTROLLERDELEGATION_);
create index IDX_TASKINST_PRCINS on JBPM_TASKINSTANCE (PROCINST_);
create index IDX_TSKINST_TMINST on JBPM_TASKINSTANCE (TASKMGMTINSTANCE_);
create index IDX_TSKINST_SLINST on JBPM_TASKINSTANCE (SWIMLANINSTANCE_);
create index IDX_TASKINST_TOKN on JBPM_TASKINSTANCE (TOKEN_);
create index IDX_TASK_ACTORID on JBPM_TASKINSTANCE (ACTORID_);
create index IDX_TASKINST_TSK on JBPM_TASKINSTANCE (TASK_, PROCINST_);
create index IDX_TOKEN_PARENT on JBPM_TOKEN (PARENT_);
create index IDX_TOKEN_PROCIN on JBPM_TOKEN (PROCESSINSTANCE_);
create index IDX_TOKEN_NODE on JBPM_TOKEN (NODE_);
create index IDX_TOKEN_SUBPI on JBPM_TOKEN (SUBPROCESSINSTANCE_);
create index IDX_TKVVARMP_TOKEN on JBPM_TOKENVARIABLEMAP (TOKEN_);
create index IDX_TKVARMAP_CTXT on JBPM_TOKENVARIABLEMAP (CONTEXTINSTANCE_);
create index IDX_TRANS_PROCDEF on JBPM_TRANSITION (PROCESSDEFINITION_);
create index IDX_TRANSIT_FROM on JBPM_TRANSITION (FROM_);
create index IDX_TRANSIT_TO on JBPM_TRANSITION (TO_);
create index IDX_VARINST_TK on JBPM_VARIABLEINSTANCE (TOKEN_);
create index IDX_VARINST_TKVARMP on JBPM_VARIABLEINSTANCE (TOKENVARIABLEMAP_);
create index IDX_VARINST_PRCINS on JBPM_VARIABLEINSTANCE (PROCESSINSTANCE_);
create index IDX_BYTEINST_ARRAY on JBPM_VARIABLEINSTANCE (BYTEARRAYVALUE_);
