<?xml version="1.0"?>

<data>
	<tables-sql><![CDATA[create table CTAutoResolutionInfo (
	mvccVersion LONG default 0 not null,
	ctAutoResolutionInfoId LONG not null primary key,
	companyId LONG,
	createDate DATE null,
	ctCollectionId LONG,
	modelClassNameId LONG,
	sourceModelClassPK LONG,
	targetModelClassPK LONG,
	conflictIdentifier VARCHAR(500) null
);

create table CTCollection (
	mvccVersion LONG default 0 not null,
	uuid_ VARCHAR(75) null,
	externalReferenceCode VARCHAR(75) null,
	ctCollectionId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	modifiedDate DATE null,
	ctRemoteId LONG,
	schemaVersionId LONG,
	name VARCHAR(75) null,
	description VARCHAR(200) null,
	onDemandUserId LONG,
	shareable BOOLEAN,
	status INTEGER,
	statusByUserId LONG,
	statusDate DATE null
);

create table CTCollectionTemplate (
	mvccVersion LONG default 0 not null,
	ctCollectionTemplateId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	modifiedDate DATE null,
	name VARCHAR(75) null,
	description VARCHAR(200) null
);

create table CTComment (
	mvccVersion LONG default 0 not null,
	ctCommentId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	modifiedDate DATE null,
	ctCollectionId LONG,
	ctEntryId LONG,
	value TEXT null
);

create table CTEntry (
	mvccVersion LONG default 0 not null,
	uuid_ VARCHAR(75) null,
	externalReferenceCode VARCHAR(75) null,
	ctEntryId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	modifiedDate DATE null,
	ctCollectionId LONG,
	modelClassNameId LONG,
	modelClassPK LONG,
	modelMvccVersion LONG,
	changeType INTEGER
);

create table CTMessage (
	mvccVersion LONG default 0 not null,
	ctMessageId LONG not null primary key,
	companyId LONG,
	ctCollectionId LONG,
	messageContent TEXT null
);

create table CTPreferences (
	mvccVersion LONG default 0 not null,
	ctPreferencesId LONG not null primary key,
	companyId LONG,
	userId LONG,
	ctCollectionId LONG,
	previousCtCollectionId LONG,
	confirmationEnabled BOOLEAN
);

create table CTProcess (
	mvccVersion LONG default 0 not null,
	ctProcessId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	ctCollectionId LONG,
	backgroundTaskId LONG,
	type_ INTEGER
);

create table CTRemote (
	mvccVersion LONG default 0 not null,
	ctRemoteId LONG not null primary key,
	companyId LONG,
	userId LONG,
	createDate DATE null,
	modifiedDate DATE null,
	name VARCHAR(75) null,
	description VARCHAR(75) null,
	url VARCHAR(75) null,
	clientId VARCHAR(75) null,
	clientSecret VARCHAR(75) null
);

create table CTSchemaVersion (
	mvccVersion LONG default 0 not null,
	schemaVersionId LONG not null primary key,
	companyId LONG,
	schemaContext TEXT null
);]]></tables-sql>
	<sequences-sql><![CDATA[]]></sequences-sql>
	<indexes-sql><![CDATA[create index IX_F925260 on CTAutoResolutionInfo (ctCollectionId, modelClassNameId, sourceModelClassPK);

create unique index IX_30F5BCCA on CTCollection (companyId, externalReferenceCode[$COLUMN_LENGTH:75$]);
create index IX_8D52E6F9 on CTCollection (companyId, status);
create index IX_CCDD86CD on CTCollection (schemaVersionId);
create index IX_DA0BBE1F on CTCollection (uuid_[$COLUMN_LENGTH:75$]);

create index IX_489283B9 on CTCollectionTemplate (companyId);

create index IX_FE644B52 on CTComment (ctCollectionId);
create index IX_C5E592B8 on CTComment (ctEntryId);

create unique index IX_295C418C on CTEntry (ctCollectionId, modelClassNameId, modelClassPK);
create unique index IX_7FBB3312 on CTEntry (externalReferenceCode[$COLUMN_LENGTH:75$], companyId);
create index IX_E1E08DCD on CTEntry (uuid_[$COLUMN_LENGTH:75$]);

create index IX_9FB742FA on CTMessage (ctCollectionId);

create unique index IX_516E5375 on CTPreferences (companyId, userId);
create index IX_3FECC82B on CTPreferences (ctCollectionId);
create index IX_D9EA7A42 on CTPreferences (previousCtCollectionId);

create index IX_7523B0A4 on CTProcess (companyId);
create index IX_46BA2033 on CTProcess (ctCollectionId, type_);

create index IX_9B9391EB on CTRemote (companyId);

create index IX_687AE35C on CTSchemaVersion (companyId);]]></indexes-sql>
</data>