<?xml version="1.0"?>

<data>
	<tables-sql><![CDATA[create table KaleoAction (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoActionId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeName VARCHAR(200) null,
	name VARCHAR(200) null,
	description STRING null,
	executionType VARCHAR(20) null,
	script TEXT null,
	scriptLanguage VARCHAR(255) null,
	scriptRequiredContexts STRING null,
	priority INTEGER,
	type_ VARCHAR(75) null,
	status INTEGER,
	primary key (kaleoActionId, ctCollectionId)
);

create table KaleoCondition (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoConditionId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeId LONG,
	script TEXT null,
	scriptLanguage VARCHAR(75) null,
	scriptRequiredContexts STRING null,
	primary key (kaleoConditionId, ctCollectionId)
);

create table KaleoDefinition (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoDefinitionId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	name VARCHAR(200) null,
	title STRING null,
	description STRING null,
	content TEXT null,
	scope VARCHAR(75) null,
	version INTEGER,
	active_ BOOLEAN,
	primary key (kaleoDefinitionId, ctCollectionId)
);

create table KaleoDefinitionVersion (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoDefinitionVersionId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	name VARCHAR(200) null,
	title STRING null,
	description STRING null,
	content TEXT null,
	version VARCHAR(75) null,
	startKaleoNodeId LONG,
	status INTEGER,
	statusByUserId LONG,
	statusByUserName VARCHAR(75) null,
	statusDate DATE null,
	primary key (kaleoDefinitionVersionId, ctCollectionId)
);

create table KaleoInstance (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoInstanceId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoDefinitionName VARCHAR(200) null,
	kaleoDefinitionVersion INTEGER,
	rootKaleoInstanceTokenId LONG,
	active_ BOOLEAN,
	className VARCHAR(200) null,
	classPK LONG,
	completed BOOLEAN,
	completionDate DATE null,
	workflowContext TEXT null,
	primary key (kaleoInstanceId, ctCollectionId)
);

create table KaleoInstanceToken (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoInstanceTokenId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	parentKaleoInstanceTokenId LONG,
	currentKaleoNodeId LONG,
	currentKaleoNodeName VARCHAR(200) null,
	className VARCHAR(200) null,
	classPK LONG,
	completed BOOLEAN,
	completionDate DATE null,
	primary key (kaleoInstanceTokenId, ctCollectionId)
);

create table KaleoLog (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoLogId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	kaleoInstanceTokenId LONG,
	kaleoTaskInstanceTokenId LONG,
	kaleoNodeName VARCHAR(200) null,
	terminalKaleoNode BOOLEAN,
	kaleoActionId LONG,
	kaleoActionName VARCHAR(200) null,
	kaleoActionDescription STRING null,
	previousKaleoNodeId LONG,
	previousKaleoNodeName VARCHAR(200) null,
	previousAssigneeClassName VARCHAR(200) null,
	previousAssigneeClassPK LONG,
	currentAssigneeClassName VARCHAR(200) null,
	currentAssigneeClassPK LONG,
	type_ VARCHAR(50) null,
	comment_ TEXT null,
	startDate DATE null,
	endDate DATE null,
	duration LONG,
	workflowContext TEXT null,
	primary key (kaleoLogId, ctCollectionId)
);

create table KaleoNode (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoNodeId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	name VARCHAR(200) null,
	label STRING null,
	metadata STRING null,
	description STRING null,
	type_ VARCHAR(20) null,
	initial_ BOOLEAN,
	terminal BOOLEAN,
	primary key (kaleoNodeId, ctCollectionId)
);

create table KaleoNotification (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoNotificationId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeName VARCHAR(200) null,
	name VARCHAR(200) null,
	description STRING null,
	executionType VARCHAR(20) null,
	template TEXT null,
	templateLanguage VARCHAR(75) null,
	notificationTypes VARCHAR(255) null,
	primary key (kaleoNotificationId, ctCollectionId)
);

create table KaleoNotificationRecipient (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoNotificationRecipientId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNotificationId LONG,
	recipientClassName VARCHAR(200) null,
	recipientClassPK LONG,
	recipientRoleType INTEGER,
	recipientScript TEXT null,
	recipientScriptLanguage VARCHAR(75) null,
	recipientScriptContexts STRING null,
	address VARCHAR(255) null,
	notificationReceptionType VARCHAR(3) null,
	primary key (kaleoNotificationRecipientId, ctCollectionId)
);

create table KaleoTask (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeId LONG,
	name VARCHAR(200) null,
	description STRING null,
	primary key (kaleoTaskId, ctCollectionId)
);

create table KaleoTaskAssignment (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskAssignmentId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeId LONG,
	assigneeClassName VARCHAR(200) null,
	assigneeClassPK LONG,
	assigneeActionId VARCHAR(75) null,
	assigneeScript TEXT null,
	assigneeScriptLanguage VARCHAR(75) null,
	assigneeScriptRequiredContexts STRING null,
	primary key (kaleoTaskAssignmentId, ctCollectionId)
);

create table KaleoTaskAssignmentInstance (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskAssignmentInstanceId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	kaleoInstanceTokenId LONG,
	kaleoTaskInstanceTokenId LONG,
	kaleoTaskId LONG,
	kaleoTaskName VARCHAR(200) null,
	assigneeClassName VARCHAR(200) null,
	assigneeClassPK LONG,
	completed BOOLEAN,
	completionDate DATE null,
	primary key (kaleoTaskAssignmentInstanceId, ctCollectionId)
);

create table KaleoTaskForm (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskFormId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(75) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeId LONG,
	kaleoTaskId LONG,
	kaleoTaskName VARCHAR(200) null,
	name VARCHAR(200) null,
	description STRING null,
	formCompanyId LONG,
	formDefinition STRING null,
	formGroupId LONG,
	formId LONG,
	formUuid VARCHAR(75) null,
	metadata STRING null,
	priority INTEGER,
	primary key (kaleoTaskFormId, ctCollectionId)
);

create table KaleoTaskFormInstance (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskFormInstanceId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(75) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	kaleoTaskId LONG,
	kaleoTaskInstanceTokenId LONG,
	kaleoTaskFormId LONG,
	formValues STRING null,
	formValueEntryGroupId LONG,
	formValueEntryId LONG,
	formValueEntryUuid VARCHAR(75) null,
	metadata STRING null,
	primary key (kaleoTaskFormInstanceId, ctCollectionId)
);

create table KaleoTaskInstanceToken (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTaskInstanceTokenId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	kaleoInstanceTokenId LONG,
	kaleoTaskId LONG,
	kaleoTaskName VARCHAR(200) null,
	className VARCHAR(200) null,
	classPK LONG,
	completionUserId LONG,
	completed BOOLEAN,
	completionDate DATE null,
	dueDate DATE null,
	workflowContext TEXT null,
	primary key (kaleoTaskInstanceTokenId, ctCollectionId)
);

create table KaleoTimer (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTimerId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	name VARCHAR(75) null,
	blocking BOOLEAN,
	description STRING null,
	duration DOUBLE,
	scale VARCHAR(75) null,
	recurrenceDuration DOUBLE,
	recurrenceScale VARCHAR(75) null,
	primary key (kaleoTimerId, ctCollectionId)
);

create table KaleoTimerInstanceToken (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTimerInstanceTokenId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoClassName VARCHAR(200) null,
	kaleoClassPK LONG,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoInstanceId LONG,
	kaleoInstanceTokenId LONG,
	kaleoTaskInstanceTokenId LONG,
	kaleoTimerId LONG,
	kaleoTimerName VARCHAR(200) null,
	blocking BOOLEAN,
	completionUserId LONG,
	completed BOOLEAN,
	completionDate DATE null,
	workflowContext TEXT null,
	primary key (kaleoTimerInstanceTokenId, ctCollectionId)
);

create table KaleoTransition (
	mvccVersion LONG default 0 not null,
	ctCollectionId LONG default 0 not null,
	kaleoTransitionId LONG not null,
	groupId LONG,
	companyId LONG,
	userId LONG,
	userName VARCHAR(200) null,
	createDate DATE null,
	modifiedDate DATE null,
	kaleoDefinitionId LONG,
	kaleoDefinitionVersionId LONG,
	kaleoNodeId LONG,
	name VARCHAR(200) null,
	label STRING null,
	description STRING null,
	sourceKaleoNodeId LONG,
	sourceKaleoNodeName VARCHAR(200) null,
	targetKaleoNodeId LONG,
	targetKaleoNodeName VARCHAR(200) null,
	defaultTransition BOOLEAN,
	primary key (kaleoTransitionId, ctCollectionId)
);]]></tables-sql>
	<sequences-sql><![CDATA[]]></sequences-sql>
	<indexes-sql><![CDATA[create index IX_50E9112C on KaleoAction (companyId);
create index IX_ED710674 on KaleoAction (kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK, companyId, executionType[$COLUMN_LENGTH:20$]);
create index IX_4B2545E8 on KaleoAction (kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK, executionType[$COLUMN_LENGTH:20$]);
create index IX_F8808C50 on KaleoAction (kaleoDefinitionVersionId);

create index IX_FEE46067 on KaleoCondition (companyId);
create index IX_353B7FB5 on KaleoCondition (kaleoDefinitionVersionId);
create index IX_86CBD4C on KaleoCondition (kaleoNodeId);

create index IX_EEFC11D0 on KaleoDefinition (active_);
create index IX_37ED1EF9 on KaleoDefinition (companyId, active_, name[$COLUMN_LENGTH:200$]);
create index IX_D1C1A80A on KaleoDefinition (companyId, active_, scope[$COLUMN_LENGTH:75$]);
create index IX_EC14F81A on KaleoDefinition (companyId, name[$COLUMN_LENGTH:200$], version);
create index IX_6E339BF5 on KaleoDefinition (companyId, scope[$COLUMN_LENGTH:75$]);

create unique index IX_3ADEC2A on KaleoDefinitionVersion (companyId, name[$COLUMN_LENGTH:200$], version[$COLUMN_LENGTH:75$], ctCollectionId);

create index IX_58D85ECB on KaleoInstance (className[$COLUMN_LENGTH:200$], classPK);
create index IX_BF5839F8 on KaleoInstance (companyId, kaleoDefinitionName[$COLUMN_LENGTH:200$], kaleoDefinitionVersion, completionDate);
create index IX_DFAFED59 on KaleoInstance (companyId, userId, kaleoInstanceId);
create index IX_3D0874DE on KaleoInstance (completed, kaleoDefinitionId);
create index IX_3DA1A5AC on KaleoInstance (kaleoDefinitionVersionId, completed);

create index IX_360D34D9 on KaleoInstanceToken (companyId, parentKaleoInstanceTokenId, completionDate);
create index IX_1181057E on KaleoInstanceToken (kaleoDefinitionVersionId);
create index IX_F42AAFF6 on KaleoInstanceToken (kaleoInstanceId);

create index IX_73B5F4DE on KaleoLog (companyId);
create index IX_935D8E5E on KaleoLog (kaleoDefinitionVersionId);
create index IX_5BC6AB16 on KaleoLog (kaleoInstanceId);
create index IX_18212EF6 on KaleoLog (kaleoInstanceTokenId, type_[$COLUMN_LENGTH:50$], kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK);
create index IX_B0CDCA38 on KaleoLog (kaleoTaskInstanceTokenId);

create index IX_4B1D16B4 on KaleoNode (companyId, kaleoDefinitionVersionId);
create index IX_F066921C on KaleoNode (kaleoDefinitionVersionId);

create index IX_38829497 on KaleoNotification (companyId);
create index IX_F3362E93 on KaleoNotification (kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK, executionType[$COLUMN_LENGTH:20$]);
create index IX_B8486585 on KaleoNotification (kaleoDefinitionVersionId);

create index IX_2C8C4AF4 on KaleoNotificationRecipient (companyId);
create index IX_B6D98988 on KaleoNotificationRecipient (kaleoDefinitionVersionId);
create index IX_7F4FED02 on KaleoNotificationRecipient (kaleoNotificationId);

create index IX_E1F8B23D on KaleoTask (companyId);
create index IX_FECA871F on KaleoTask (kaleoDefinitionVersionId);
create index IX_77B3F1A2 on KaleoTask (kaleoNodeId);

create index IX_611732B0 on KaleoTaskAssignment (companyId);
create index IX_1087068E on KaleoTaskAssignment (kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK, assigneeClassName[$COLUMN_LENGTH:200$]);
create index IX_E362B24C on KaleoTaskAssignment (kaleoDefinitionVersionId);

create index IX_3BD436FD on KaleoTaskAssignmentInstance (assigneeClassName[$COLUMN_LENGTH:200$], assigneeClassPK);
create index IX_3E60C5A5 on KaleoTaskAssignmentInstance (assigneeClassName[$COLUMN_LENGTH:200$], kaleoTaskInstanceTokenId);
create index IX_F6042803 on KaleoTaskAssignmentInstance (assigneeClassPK, groupId);
create index IX_6E3CDA1B on KaleoTaskAssignmentInstance (companyId);
create index IX_B751E781 on KaleoTaskAssignmentInstance (kaleoDefinitionVersionId);
create index IX_67A9EE93 on KaleoTaskAssignmentInstance (kaleoInstanceId);
create index IX_D4C2235B on KaleoTaskAssignmentInstance (kaleoTaskInstanceTokenId);

create index IX_EFDA7E59 on KaleoTaskForm (companyId);
create index IX_3B8B7F83 on KaleoTaskForm (kaleoDefinitionVersionId);
create index IX_945326BE on KaleoTaskForm (kaleoNodeId);
create index IX_E38A5954 on KaleoTaskForm (kaleoTaskId, formUuid[$COLUMN_LENGTH:75$]);

create index IX_77B26CC4 on KaleoTaskFormInstance (companyId);
create index IX_F118DB8 on KaleoTaskFormInstance (kaleoDefinitionVersionId);
create index IX_FF271E7C on KaleoTaskFormInstance (kaleoInstanceId);
create index IX_E7F42BD0 on KaleoTaskFormInstance (kaleoTaskFormId);
create index IX_2A86346C on KaleoTaskFormInstance (kaleoTaskId);
create index IX_2C81C992 on KaleoTaskFormInstance (kaleoTaskInstanceTokenId);

create index IX_A3271995 on KaleoTaskInstanceToken (className[$COLUMN_LENGTH:200$], classPK);
create index IX_4B55EBE on KaleoTaskInstanceToken (companyId, userId, completed);
create index IX_B2822979 on KaleoTaskInstanceToken (kaleoDefinitionVersionId);
create index IX_B857A115 on KaleoTaskInstanceToken (kaleoInstanceId, kaleoTaskId);

create index IX_1A479F32 on KaleoTimer (kaleoClassName[$COLUMN_LENGTH:200$], kaleoClassPK, blocking);

create index IX_DB96C55B on KaleoTimerInstanceToken (kaleoInstanceId);
create index IX_9932524C on KaleoTimerInstanceToken (kaleoInstanceTokenId, completed, blocking);
create index IX_13A5BA2C on KaleoTimerInstanceToken (kaleoInstanceTokenId, kaleoTimerId);

create index IX_41D6C6D on KaleoTransition (companyId);
create index IX_16B426EF on KaleoTransition (kaleoDefinitionVersionId);
create index IX_A38E2194 on KaleoTransition (kaleoNodeId, defaultTransition);
create index IX_85268A11 on KaleoTransition (kaleoNodeId, name[$COLUMN_LENGTH:200$]);]]></indexes-sql>
</data>