<?xml version="1.0"?>

<data>
	<tables-sql><![CDATA[create table messagerie_Account (
	accountId LONG not null primary key,
	companyId LONG,
	userId LONG,
	userName VARCHAR(250) null,
	createDate DATE null,
	modifiedDate DATE null,
	address VARCHAR(250) null,
	personalName VARCHAR(250) null,
	protocol VARCHAR(250) null,
	incomingHostName VARCHAR(250) null,
	incomingPort INTEGER,
	incomingSecure BOOLEAN,
	outgoingHostName VARCHAR(250) null,
	outgoingPort INTEGER,
	outgoingSecure BOOLEAN,
	login VARCHAR(250) null,
	password_ VARCHAR(250) null,
	savePassword BOOLEAN,
	signature VARCHAR(250) null,
	useSignature BOOLEAN,
	folderPrefix VARCHAR(250) null,
	inboxFolderId LONG,
	draftFolderId LONG,
	sentFolderId LONG,
	trashFolderId LONG,
	defaultSender BOOLEAN
);

create table messagerie_Attachment (
	attachmentId LONG not null primary key,
	companyId LONG,
	userId LONG,
	accountId LONG,
	folderId LONG,
	messageId LONG,
	contentPath VARCHAR(250) null,
	fileName VARCHAR(250) null,
	size_ LONG
);

create table messagerie_ExternalCommunicationRights (
	etabId LONG not null primary key,
	hasNational1Rights BOOLEAN,
	hasNational2Rights BOOLEAN,
	hasNational3Rights BOOLEAN,
	hasNational4Rights BOOLEAN,
	hasNational7Rights BOOLEAN
);

create table messagerie_Folder (
	folderId LONG not null primary key,
	companyId LONG,
	userId LONG,
	userName VARCHAR(250) null,
	createDate DATE null,
	modifiedDate DATE null,
	accountId LONG,
	fullName VARCHAR(250) null,
	displayName VARCHAR(250) null,
	remoteMessageCount INTEGER
);

create table messagerie_InternalAttachFile (
	internalAttachFileId LONG not null primary key,
	attachFileId LONG,
	messageId LONG,
	attachFileType VARCHAR(150) null
);

create table messagerie_InternalAutoResponse (
	internalAutoResponseId LONG not null primary key,
	name VARCHAR(75) null,
	userId LONG,
	objectId LONG,
	className VARCHAR(75) null,
	subject VARCHAR(250) null,
	content STRING null,
	active_ BOOLEAN,
	receive BOOLEAN
);

create table messagerie_InternalContent (
	messageId LONG not null primary key,
	messageContent STRING null
);

create table messagerie_InternalFolderMessage (
	folderMessageId LONG not null primary key,
	userId LONG,
	folderName VARCHAR(75) null,
	folderType VARCHAR(75) null,
	nodePath VARCHAR(250) null,
	isDeletable BOOLEAN,
	orderEntity INTEGER
);

create table messagerie_InternalMessage (
	messageId LONG not null primary key,
	companyId LONG,
	folderMessageId LONG,
	senderId LONG,
	senderName VARCHAR(250) null,
	firstReceiverName VARCHAR(250) null,
	messageSubject STRING null,
	messageContent STRING null,
	sendDate DATE null,
	isNew BOOLEAN,
	pjFolderId LONG,
	messageSendId LONG,
	flags VARCHAR(250) null,
	isNotifiedNew BOOLEAN
);

create table messagerie_InternalReceiver (
	internalReceiverId LONG not null primary key,
	receiverId LONG,
	messageId LONG
);

create table messagerie_InternalReceivers (
	messageId LONG not null primary key,
	receivers STRING null
);

create table messagerie_Message (
	messageId LONG not null primary key,
	companyId LONG,
	userId LONG,
	userName VARCHAR(250) null,
	createDate DATE null,
	modifiedDate DATE null,
	accountId LONG,
	folderId LONG,
	sender VARCHAR(250) null,
	to_ STRING null,
	cc STRING null,
	bcc STRING null,
	sentDate DATE null,
	subject STRING null,
	preview STRING null,
	body STRING null,
	flags VARCHAR(250) null,
	size_ LONG,
	remoteMessageId LONG
);

create table messagerie_RssChanel (
	chanelId LONG not null primary key,
	userId LONG,
	url VARCHAR(250) null,
	title VARCHAR(250) null,
	description STRING null,
	link VARCHAR(250) null,
	urlImage VARCHAR(250) null,
	pubDate DATE null,
	lastBuildDate DATE null,
	lastUpdateDate DATE null,
	active_ BOOLEAN
);

create table messagerie_RssItem (
	itemId LONG not null primary key,
	companyId LONG,
	userId LONG,
	chanelId LONG,
	chanelTitle VARCHAR(250) null,
	guid INTEGER,
	title VARCHAR(250) null,
	body STRING null,
	pubDate DATE null,
	schemaType VARCHAR(75) null,
	state_ VARCHAR(75) null,
	canBeDelete BOOLEAN
);]]></tables-sql>
	<sequences-sql><![CDATA[]]></sequences-sql>
	<indexes-sql><![CDATA[create index IX_4AD5C135 on messagerie_Account (userId);
create index IX_3557688F on messagerie_Account (userId, address);

create index IX_DA7ECE31 on messagerie_Attachment (messageId);

create index IX_EAA5770F on messagerie_ExternalCommunicationRights (etabId);

create index IX_D3A5E7EC on messagerie_Folder (accountId);
create index IX_13C9B71A on messagerie_Folder (accountId, fullName);

create index IX_8894D336 on messagerie_InternalAttachFile (messageId);

create index IX_3442AFE5 on messagerie_InternalAutoResponse (userId);
create index IX_3723D0C4 on messagerie_InternalAutoResponse (userId, active_);

create index IX_50041768 on messagerie_InternalContent (messageId);

create index IX_7DD2EA44 on messagerie_InternalFolderMessage (userId);
create index IX_A9937D80 on messagerie_InternalFolderMessage (userId, folderType);
create index IX_1C827FBF on messagerie_InternalFolderMessage (userId, nodePath);

create index IX_B8551410 on messagerie_InternalMessage (companyId);
create index IX_F19E38CC on messagerie_InternalMessage (folderMessageId);
create index IX_ED168EFA on messagerie_InternalMessage (folderMessageId, isNew);
create index IX_E8EA7C42 on messagerie_InternalMessage (folderMessageId, isNotifiedNew);
create index IX_B2DE3C5F on messagerie_InternalMessage (folderMessageId, senderName, messageSubject, messageContent);
create index IX_7715F3C2 on messagerie_InternalMessage (messageSendId);

create index IX_442A6428 on messagerie_InternalReceiver (messageId);

create index IX_558ABC1D on messagerie_InternalReceivers (messageId);

create index IX_E76711B3 on messagerie_Message (companyId);
create index IX_5B8BF2 on messagerie_Message (folderId);
create index IX_7DE71A5A on messagerie_Message (folderId, remoteMessageId);

create index IX_7AB203F3 on messagerie_RssChanel (userId);
create index IX_32B72C76 on messagerie_RssChanel (userId, active_);

create index IX_CDA268FB on messagerie_RssItem (chanelId);
create index IX_8A0E1DF5 on messagerie_RssItem (companyId);
create index IX_2A2C9E50 on messagerie_RssItem (guid);
create index IX_6EFCC1C8 on messagerie_RssItem (pubDate);
create index IX_9003598D on messagerie_RssItem (userId);
create index IX_D35FDB5 on messagerie_RssItem (userId, chanelId);]]></indexes-sql>
</data>