Skip to content

Instantly share code, notes, and snippets.

@BenMatheja
Created December 10, 2013 22:00
Show Gist options
  • Save BenMatheja/7901035 to your computer and use it in GitHub Desktop.
Save BenMatheja/7901035 to your computer and use it in GitHub Desktop.
CREATE TABLE Infinity.activity_instance (oid BIGINT AUTO_INCREMENT PRIMARY KEY, state INT, startTime BIGINT, lastModificationTime BIGINT, model BIGINT, activity BIGINT, currentPerformer BIGINT, currentUserPerformer BIGINT, performedBy BIGINT, currentDepartment BIGINT, processInstance BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX activity_inst_idx1 ON Infinity.activity_instance(oid);
CREATE INDEX activity_inst_idx2 ON Infinity.activity_instance(currentPerformer, currentDepartment);
CREATE INDEX activity_inst_idx3 ON Infinity.activity_instance(currentUserPerformer, currentPerformer, currentDepartment);
CREATE INDEX activity_inst_idx4 ON Infinity.activity_instance(performedBy);
CREATE INDEX activity_inst_idx5 ON Infinity.activity_instance(processInstance);
CREATE INDEX activity_inst_idx6 ON Infinity.activity_instance(startTime, activity, state);
CREATE INDEX activity_inst_idx7 ON Infinity.activity_instance(state);
CREATE INDEX activity_inst_idx8 ON Infinity.activity_instance(activity, processInstance);
CREATE TABLE Infinity.activity_inst_log (oid BIGINT AUTO_INCREMENT PRIMARY KEY, type INT, stamp BIGINT, model BIGINT, participant BIGINT, workflowUser BIGINT, activityInstance BIGINT) TYPE=InnoDB;
CREATE INDEX act_inst_log_idx1 ON Infinity.activity_inst_log(activityInstance);
CREATE UNIQUE INDEX act_inst_log_idx2 ON Infinity.activity_inst_log(oid);
CREATE TABLE Infinity.act_inst_history (processInstance BIGINT, activityInstance BIGINT, state INT, fromTimestamp BIGINT, untilTimestamp BIGINT, domain BIGINT, performerKind INT, performer BIGINT, department BIGINT, onBehalfOfKind INT, onBehalfOf BIGINT, onBehalfOfDepartment BIGINT, workflowUser BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX act_inst_hist_idx1 ON Infinity.act_inst_history(activityInstance, fromTimestamp);
CREATE INDEX act_inst_hist_idx2 ON Infinity.act_inst_history(processInstance);
CREATE TABLE Infinity.act_inst_property (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectOID BIGINT, name VARCHAR(255), type_key INT, number_value BIGINT, string_value VARCHAR(128), lastModificationTime BIGINT, workflowUser BIGINT) TYPE=InnoDB;
CREATE INDEX act_inst_prp_idx1 ON Infinity.act_inst_property(objectOID);
CREATE INDEX act_inst_prp_idx2 ON Infinity.act_inst_property(type_key, number_value);
CREATE INDEX act_inst_prp_idx3 ON Infinity.act_inst_property(type_key, string_value);
CREATE UNIQUE INDEX act_inst_prp_idx4 ON Infinity.act_inst_property(oid);
CREATE TABLE Infinity.trans_inst (oid BIGINT AUTO_INCREMENT PRIMARY KEY, model BIGINT, transition BIGINT, processInstance BIGINT, source BIGINT, target BIGINT) TYPE=InnoDB;
CREATE INDEX trans_inst_idx1 ON Infinity.trans_inst(processInstance);
CREATE UNIQUE INDEX trans_inst_idx2 ON Infinity.trans_inst(oid);
CREATE TABLE Infinity.trans_token (oid BIGINT AUTO_INCREMENT PRIMARY KEY, processInstance BIGINT, model BIGINT, transition BIGINT, source BIGINT, target BIGINT, isConsumed INT) TYPE=InnoDB;
CREATE INDEX trans_token_idx1 ON Infinity.trans_token(processInstance);
CREATE UNIQUE INDEX trans_token_idx2 ON Infinity.trans_token(oid);
CREATE INDEX trans_token_idx3 ON Infinity.trans_token(processInstance, transition, model, isConsumed);
CREATE TABLE Infinity.daemon_log (oid BIGINT AUTO_INCREMENT PRIMARY KEY, type VARCHAR(100), code INT, stamp BIGINT, state INT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX daemon_log_idx1 ON Infinity.daemon_log(oid);
CREATE INDEX daemon_log_idx2 ON Infinity.daemon_log(code, partition, type);
CREATE TABLE Infinity.data_value (oid BIGINT AUTO_INCREMENT PRIMARY KEY, model BIGINT, data BIGINT, string_value VARCHAR(128), number_value BIGINT, type_key INT, processInstance BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX data_values_index1 ON Infinity.data_value(oid);
CREATE INDEX data_values_index2 ON Infinity.data_value(processInstance);
CREATE INDEX data_values_index3 ON Infinity.data_value(type_key);
CREATE INDEX data_values_index4 ON Infinity.data_value(number_value);
CREATE INDEX data_values_index5 ON Infinity.data_value(string_value);
CREATE UNIQUE INDEX data_values_index6 ON Infinity.data_value(data, processInstance);
CREATE TABLE Infinity.event_binding (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectOID BIGINT, type INT, model BIGINT, handlerOID BIGINT, bindStamp BIGINT, targetStamp BIGINT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX event_binding_idx1 ON Infinity.event_binding(oid);
CREATE INDEX event_binding_idx2 ON Infinity.event_binding(objectOID, type, handlerOID, model, partition);
CREATE INDEX event_binding_idx3 ON Infinity.event_binding(targetStamp, partition);
CREATE TABLE Infinity.log_entry (oid BIGINT AUTO_INCREMENT PRIMARY KEY, type INT, code INT, subject TEXT, stamp BIGINT, processInstance BIGINT, activityInstance BIGINT, workflowUser BIGINT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX log_entry_idx1 ON Infinity.log_entry(oid);
CREATE INDEX log_entry_idx2 ON Infinity.log_entry(activityInstance);
CREATE INDEX log_entry_idx3 ON Infinity.log_entry(processInstance);
CREATE TABLE Infinity.message_store (oid BIGINT AUTO_INCREMENT PRIMARY KEY, source VARCHAR(255), arrivalTime BIGINT, rCount BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX message_store_idx1 ON Infinity.message_store(oid);
CREATE INDEX message_store_idx2 ON Infinity.message_store(source);
CREATE INDEX message_store_idx3 ON Infinity.message_store(arrivalTime, rCount);
CREATE TABLE Infinity.property (oid BIGINT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), value TEXT, locale VARCHAR(255), flags INT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX property_idx1 ON Infinity.property(oid);
CREATE TABLE Infinity.timer_log (oid BIGINT AUTO_INCREMENT PRIMARY KEY, model BIGINT, triggerOID BIGINT, stamp BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX timer_log_idx1 ON Infinity.timer_log(oid);
CREATE TABLE Infinity.usergroup (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), name VARCHAR(150), validFrom BIGINT, validTo BIGINT, description VARCHAR(255), partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX usergroup_idx1 ON Infinity.usergroup(oid);
CREATE UNIQUE INDEX usergroup_idx2 ON Infinity.usergroup(id, partition);
CREATE TABLE Infinity.usergroup_property (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectOID BIGINT, name VARCHAR(255), type_key INT, number_value BIGINT, string_value VARCHAR(128), lastModificationTime BIGINT, workflowUser BIGINT) TYPE=InnoDB;
CREATE INDEX usergrp_prp_idx1 ON Infinity.usergroup_property(objectOID);
CREATE INDEX usergrp_prp_idx2 ON Infinity.usergroup_property(type_key, number_value);
CREATE INDEX usergrp_prp_idx3 ON Infinity.usergroup_property(type_key, string_value);
CREATE UNIQUE INDEX usergrp_prp_idx4 ON Infinity.usergroup_property(oid);
CREATE TABLE Infinity.workflowuser (oid BIGINT AUTO_INCREMENT PRIMARY KEY, account VARCHAR(50), firstName VARCHAR(150), lastName VARCHAR(150), password VARCHAR(255), eMail VARCHAR(150), validFrom BIGINT, validTo BIGINT, description VARCHAR(255), failedLoginCount BIGINT, lastLoginTime BIGINT, extendedState INT, realm BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX workflowuser_idx1 ON Infinity.workflowuser(oid);
CREATE UNIQUE INDEX workflowuser_idx2 ON Infinity.workflowuser(account, realm);
CREATE TABLE Infinity.user_property (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectOID BIGINT, name VARCHAR(255), type_key INT, number_value BIGINT, string_value VARCHAR(128), lastModificationTime BIGINT, scope VARCHAR(255)) TYPE=InnoDB;
CREATE INDEX user_prp_idx1 ON Infinity.user_property(objectOID);
CREATE INDEX user_prp_idx2 ON Infinity.user_property(type_key, number_value);
CREATE INDEX user_prp_idx3 ON Infinity.user_property(type_key, string_value);
CREATE UNIQUE INDEX user_prp_idx4 ON Infinity.user_property(oid);
CREATE TABLE Infinity.wfuser_session (oid BIGINT AUTO_INCREMENT PRIMARY KEY, workflowUser BIGINT, clientId VARCHAR(255), startTime BIGINT, lastModificationTime BIGINT, expirationTime BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX wfusr_session_idx1 ON Infinity.wfuser_session(oid);
CREATE INDEX wfusr_session_idx2 ON Infinity.wfuser_session(workflowUser, startTime);
CREATE TABLE Infinity.user_participant (oid BIGINT AUTO_INCREMENT PRIMARY KEY, model BIGINT, participant BIGINT, department BIGINT, workflowUser BIGINT) TYPE=InnoDB;
CREATE INDEX user_particip_idx1 ON Infinity.user_participant(workflowUser);
CREATE INDEX user_particip_idx2 ON Infinity.user_participant(participant, department, model);
CREATE UNIQUE INDEX user_particip_idx3 ON Infinity.user_participant(oid);
CREATE TABLE Infinity.user_usergroup (oid BIGINT AUTO_INCREMENT PRIMARY KEY, workflowUser BIGINT, userGroup BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX user_usergrp_idx1 ON Infinity.user_usergroup(oid);
CREATE INDEX user_usergrp_idx2 ON Infinity.user_usergroup(workflowUser);
CREATE INDEX user_usergrp_idx3 ON Infinity.user_usergroup(userGroup);
CREATE TABLE Infinity.process_instance (oid BIGINT AUTO_INCREMENT PRIMARY KEY, startTime BIGINT, terminationTime BIGINT, state INT, model BIGINT, processDefinition BIGINT, priority INT, tokenCount BIGINT, propertiesAvailable INT, rootProcessInstance BIGINT, scopeProcessInstance BIGINT, startingUser BIGINT, startingActivityInstance BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX proc_inst_idx1 ON Infinity.process_instance(oid);
CREATE INDEX proc_inst_idx2 ON Infinity.process_instance(state, terminationTime, processDefinition);
CREATE INDEX proc_inst_idx3 ON Infinity.process_instance(state, startTime, terminationTime);
CREATE INDEX proc_inst_idx4 ON Infinity.process_instance(startingActivityInstance);
CREATE INDEX proc_inst_idx5 ON Infinity.process_instance(rootProcessInstance, state, oid);
CREATE INDEX proc_inst_idx6 ON Infinity.process_instance(scopeProcessInstance, state, oid);
CREATE TABLE Infinity.proc_inst_property (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectOID BIGINT, name VARCHAR(255), type_key INT, number_value BIGINT, string_value VARCHAR(128), lastModificationTime BIGINT, workflowUser BIGINT) TYPE=InnoDB;
CREATE INDEX proc_inst_prp_idx1 ON Infinity.proc_inst_property(objectOID);
CREATE INDEX proc_inst_prp_idx2 ON Infinity.proc_inst_property(type_key, number_value);
CREATE INDEX proc_inst_prp_idx3 ON Infinity.proc_inst_property(type_key, string_value);
CREATE UNIQUE INDEX proc_inst_prp_idx4 ON Infinity.proc_inst_property(oid);
CREATE TABLE Infinity.procinst_scope (processInstance BIGINT, scopeProcessInstance BIGINT, rootProcessInstance BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX procinst_scope_i1 ON Infinity.procinst_scope(processInstance, scopeProcessInstance);
CREATE UNIQUE INDEX procinst_scope_i2 ON Infinity.procinst_scope(scopeProcessInstance, processInstance);
CREATE INDEX procinst_scope_i3 ON Infinity.procinst_scope(rootProcessInstance);
CREATE TABLE Infinity.procinst_hierarchy (processInstance BIGINT, subProcessInstance BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX procinst_hier_idx1 ON Infinity.procinst_hierarchy(processInstance, subProcessInstance);
CREATE UNIQUE INDEX procinst_hier_idx2 ON Infinity.procinst_hierarchy(subProcessInstance, processInstance);
CREATE TABLE Infinity.structured_data_value (oid BIGINT AUTO_INCREMENT PRIMARY KEY, processInstance BIGINT, parent BIGINT, entryKey VARCHAR(50), xpath BIGINT, type_key INT, string_value VARCHAR(128), number_value BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX struct_dv_index1 ON Infinity.structured_data_value(oid);
CREATE INDEX struct_dv_index2 ON Infinity.structured_data_value(parent);
CREATE INDEX struct_dv_index3 ON Infinity.structured_data_value(xpath);
CREATE INDEX struct_dv_index4 ON Infinity.structured_data_value(type_key);
CREATE INDEX struct_dv_index5 ON Infinity.structured_data_value(number_value);
CREATE INDEX struct_dv_index6 ON Infinity.structured_data_value(string_value);
CREATE INDEX struct_dv_index7 ON Infinity.structured_data_value(processInstance);
CREATE TABLE Infinity.domain (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), description TEXT, partition BIGINT, superDomain BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX domain_idx1 ON Infinity.domain(oid);
CREATE UNIQUE INDEX domain_idx2 ON Infinity.domain(id, partition);
CREATE TABLE Infinity.domain_hierarchy (oid BIGINT AUTO_INCREMENT PRIMARY KEY, superDomain BIGINT, subDomain BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX domain_hier_idx1 ON Infinity.domain_hierarchy(oid);
CREATE UNIQUE INDEX domain_hier_idx2 ON Infinity.domain_hierarchy(superDomain, subDomain);
CREATE TABLE Infinity.wfuser_domain (oid BIGINT AUTO_INCREMENT PRIMARY KEY, validFrom BIGINT, validTo BIGINT, domain BIGINT, wfuser BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX wfuser_domain_idx1 ON Infinity.wfuser_domain(oid);
CREATE UNIQUE INDEX wfuser_domain_idx2 ON Infinity.wfuser_domain(domain, wfuser);
CREATE TABLE Infinity.wfuser_realm (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), name VARCHAR(100), description TEXT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX wfuser_realm_idx1 ON Infinity.wfuser_realm(oid);
CREATE UNIQUE INDEX wfuser_realm_idx2 ON Infinity.wfuser_realm(id, partition);
CREATE TABLE Infinity.workitem (activityInstance BIGINT, processInstance BIGINT, scopeProcessInstance BIGINT, rootProcessInstance BIGINT, model BIGINT, activity BIGINT, state INT, startTime BIGINT, lastModificationTime BIGINT, domain BIGINT, performerKind INT, performer BIGINT, department BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX workitem_idx1 ON Infinity.workitem(activityInstance);
CREATE INDEX workitem_idx2 ON Infinity.workitem(performer, department, performerKind, state);
CREATE INDEX workitem_idx3 ON Infinity.workitem(state);
CREATE INDEX workitem_idx4 ON Infinity.workitem(processInstance);
CREATE INDEX workitem_idx5 ON Infinity.workitem(scopeProcessInstance);
CREATE TABLE Infinity.structured_data (oid BIGINT, xpath VARCHAR(200), data BIGINT, model BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX struct_data_idx1 ON Infinity.structured_data(oid, model);
CREATE INDEX struct_data_idx2 ON Infinity.structured_data(xpath);
CREATE TABLE Infinity.clob_data (oid BIGINT AUTO_INCREMENT PRIMARY KEY, ownerId BIGINT, ownerType VARCHAR(32), stringValue MEDIUMTEXT) TYPE=InnoDB;
CREATE INDEX clob_dt_i1 ON Infinity.clob_data(ownerId, ownerType);
CREATE UNIQUE INDEX clob_dt_i2 ON Infinity.clob_data(oid);
CREATE TABLE Infinity.department (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), name VARCHAR(150), description TEXT, organization BIGINT, parentDepartment BIGINT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX department_idx1 ON Infinity.department(oid);
CREATE UNIQUE INDEX department_idx2 ON Infinity.department(id, organization, parentDepartment);
CREATE TABLE Infinity.department_hierarchy (superDepartment BIGINT, subDepartment BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX department_hier_idx1 ON Infinity.department_hierarchy(superDepartment, subDepartment);
CREATE UNIQUE INDEX department_hier_idx2 ON Infinity.department_hierarchy(subDepartment, superDepartment);
CREATE TABLE Infinity.model (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), name VARCHAR(255), validFrom BIGINT, validTo BIGINT, predecessor BIGINT, deploymentComment VARCHAR(255), deploymentStamp BIGINT, version VARCHAR(255), revision BIGINT, disabled BIGINT, partition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX model_idx1 ON Infinity.model(oid);
CREATE TABLE Infinity.STRING_DATA (oid BIGINT AUTO_INCREMENT PRIMARY KEY, objectid BIGINT, data_type VARCHAR(32), data TEXT) TYPE=InnoDB;
CREATE INDEX str_dt_i1 ON Infinity.STRING_DATA(objectid, data_type);
CREATE UNIQUE INDEX str_dt_i2 ON Infinity.STRING_DATA(oid);
CREATE TABLE Infinity.activity (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), processDefinition BIGINT, description TEXT) TYPE=InnoDB;
CREATE UNIQUE INDEX activity_idx1 ON Infinity.activity(oid, model);
CREATE INDEX activity_idx2 ON Infinity.activity(id, oid, model);
CREATE TABLE Infinity.data (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), description TEXT) TYPE=InnoDB;
CREATE UNIQUE INDEX data_idx1 ON Infinity.data(oid, model);
CREATE INDEX data_idx2 ON Infinity.data(id, oid, model);
CREATE TABLE Infinity.event_handler (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), processDefinition BIGINT, activity BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX event_handler_idx1 ON Infinity.event_handler(oid, model);
CREATE INDEX event_handler_idx2 ON Infinity.event_handler(id, oid, model);
CREATE TABLE Infinity.participant (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), type INT, description TEXT) TYPE=InnoDB;
CREATE UNIQUE INDEX participant_idx1 ON Infinity.participant(oid, model);
CREATE INDEX participant_idx2 ON Infinity.participant(id, oid, model);
CREATE TABLE Infinity.partition (oid BIGINT AUTO_INCREMENT PRIMARY KEY, id VARCHAR(50), description TEXT) TYPE=InnoDB;
CREATE UNIQUE INDEX partition_idx1 ON Infinity.partition(oid);
CREATE UNIQUE INDEX partition_idx2 ON Infinity.partition(id);
CREATE TABLE Infinity.process_definition (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), description TEXT) TYPE=InnoDB;
CREATE UNIQUE INDEX proc_def_idx1 ON Infinity.process_definition(oid, model);
CREATE INDEX proc_def_idx2 ON Infinity.process_definition(id, oid, model);
CREATE TABLE Infinity.transition (oid BIGINT, model BIGINT, id VARCHAR(50), processDefinition BIGINT, sourceActivity BIGINT, targetActivity BIGINT, `condition` VARCHAR(200)) TYPE=InnoDB;
CREATE UNIQUE INDEX trans_idx1 ON Infinity.transition(oid, model);
CREATE INDEX trans_idx2 ON Infinity.transition(id, oid, model);
CREATE TABLE Infinity.process_trigger (oid BIGINT, model BIGINT, id VARCHAR(50), name VARCHAR(100), processDefinition BIGINT) TYPE=InnoDB;
CREATE UNIQUE INDEX proc_trigger_idx1 ON Infinity.process_trigger(oid, model);
CREATE INDEX proc_trigger_idx2 ON Infinity.process_trigger(id, oid, model);
INSERT INTO Infinity.property (partition,name,value,locale,flags) VALUES (-1, 'sysop.password', 'sysop', 'DEFAULT', 0)
;
INSERT INTO Infinity.property (partition,name,value,locale,flags) VALUES (-1, 'carnot.version', '5.3.11', 'DEFAULT', 0)
;
INSERT INTO Infinity.partition (id,description) VALUES ('default', NULL)
;
INSERT INTO Infinity.domain (id,partition,superDomain,description) SELECT 'default', p.oid, NULL, NULL FROM partition p WHERE p.id = 'default'
;
INSERT INTO Infinity.domain_hierarchy (subDomain,superDomain) SELECT d.oid, d.oid FROM domain d WHERE d.id = 'default'
;
INSERT INTO Infinity.wfuser_realm (id,partition,name,description) SELECT 'carnot', p.oid, 'CARNOT', NULL FROM partition p WHERE p.id = 'default'
;
INSERT INTO Infinity.workflowuser (account,firstName,lastName,password,eMail,validFrom,validTo,description,failedLoginCount,lastLoginTime,realm) SELECT 'motu', 'Master', 'Of the Universe', 'motu', NULL, 1386712750127, 0, NULL, 0, 0, r.oid FROM wfuser_realm r WHERE r.id = 'carnot'
;
COMMIT
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment