<?xml version="1.0"?>

<data>
	<tables-sql><![CDATA[create table CDT_CDTSession (
	sessionId LONG not null primary key,
	sessionStart DATE null,
	sessionEnd DATE null,
	weekId LONG,
	publish BOOLEAN,
	title VARCHAR(75) null,
	description STRING null,
	room VARCHAR(75) null,
	type_ INTEGER,
	subjectId LONG,
	schoolId LONG,
	groupId LONG,
	cancelled BOOLEAN,
	previousSession LONG,
	nextSession LONG,
	sessionGroupId LONG,
	isManual BOOLEAN,
	hasAttachFile BOOLEAN,
	visa LONG,
	deleted BOOLEAN,
	deletedBy LONG,
	deleteDate DATE null,
	parentClassName VARCHAR(75) null
);

create table CDT_Configuration (
	confId LONG not null primary key,
	schoolId LONG,
	startDayTime VARCHAR(75) null,
	endDayTime VARCHAR(75) null,
	startSessionsDate DATE null,
	endSessionsDate DATE null
);

create table CDT_DailySchedule (
	schoolId LONG not null,
	sessionId INTEGER not null,
	sessionStartHour VARCHAR(75) null,
	sessionEndHour VARCHAR(75) null,
	primary key (schoolId, sessionId)
);

create table CDT_Homework (
	homeworkId LONG not null primary key,
	type_ LONG,
	sourceSessionId LONG,
	targetSessionId LONG,
	targetWeekId INTEGER,
	targetDate DATE null,
	groupId LONG,
	teacherId LONG,
	description STRING null,
	estimatedTime LONG,
	fromDate DATE null,
	hasAttachFile BOOLEAN,
	isToBeSent BOOLEAN,
	isCustomStudentList BOOLEAN
);

create table CDT_HomeworkDone (
	homeworkDoneId LONG not null primary key,
	homeworkId LONG,
	groupId LONG,
	studentId LONG,
	isDone BOOLEAN,
	isSent BOOLEAN,
	sentFileId LONG
);

create table CDT_HomeworkDropboxFolder (
	homeworkDropboxFolderId LONG not null primary key,
	homeworkId LONG,
	teacherId LONG,
	folderId LONG
);

create table CDT_SchoolSubject (
	schoolSubjectId LONG not null primary key,
	schoolId LONG,
	subjectId LONG,
	color VARCHAR(75) null
);

create table CDT_SessionStudent (
	sessionStudentId LONG not null primary key,
	sessionId LONG,
	studentId LONG
);

create table CDT_SessionTeacher (
	sessionTeacherId LONG not null primary key,
	sessionId LONG,
	teacherId LONG
);

create table CDT_StudentHomework (
	studentHomeworkId LONG not null primary key,
	homeworkId LONG,
	studentId LONG
);

create table CDT_Subject (
	subjectId LONG not null primary key,
	family VARCHAR(75) null,
	numCode VARCHAR(75) null,
	strCode VARCHAR(75) null,
	shortLabel VARCHAR(75) null,
	longLabel VARCHAR(75) null
);

create table CDT_TeacherGroupColor (
	teacherGroupColorId LONG not null primary key,
	teacherId LONG,
	groupId LONG,
	color VARCHAR(75) null
);

create table CDT_Visa (
	visaId LONG not null primary key,
	teacherId LONG,
	schoolId LONG,
	fromDate DATE null,
	toDate DATE null,
	creatorId LONG,
	creationDate DATE null
);

create table CDT_WeeklySchedule (
	schoolId LONG not null,
	dayId INTEGER not null,
	primary key (schoolId, dayId)
);]]></tables-sql>
	<sequences-sql><![CDATA[]]></sequences-sql>
	<indexes-sql><![CDATA[create index IX_290D1995 on CDT_CDTSession (groupId);
create index IX_58952638 on CDT_CDTSession (groupId, schoolId);
create index IX_4E66E5D on CDT_CDTSession (groupId, weekId, type_);
create index IX_50B1274C on CDT_CDTSession (groupId, weekId, type_, deleted);
create index IX_FD09B9AD on CDT_CDTSession (sessionGroupId);
create index IX_AB0595FC on CDT_CDTSession (sessionGroupId, deleted);

create index IX_C363F5D3 on CDT_Configuration (schoolId);

create index IX_1883B5AD on CDT_DailySchedule (schoolId);

create index IX_3614E464 on CDT_Homework (sourceSessionId);
create index IX_82277895 on CDT_Homework (targetDate);
create index IX_BF19752E on CDT_Homework (targetSessionId);
create index IX_645EF96 on CDT_Homework (targetWeekId);

create index IX_37A5C883 on CDT_HomeworkDone (homeworkId);
create index IX_2B2875C3 on CDT_HomeworkDone (homeworkId, isDone);
create index IX_44347459 on CDT_HomeworkDone (homeworkId, isSent);
create index IX_40711283 on CDT_HomeworkDone (homeworkId, studentId);

create index IX_C31D8DD3 on CDT_HomeworkDropboxFolder (homeworkId);

create index IX_1CE9E4F5 on CDT_SchoolSubject (schoolId);
create index IX_53960D42 on CDT_SchoolSubject (schoolId, subjectId);

create index IX_3ED9FD4A on CDT_SessionStudent (sessionId);
create index IX_816BEB5C on CDT_SessionStudent (sessionId, studentId);
create index IX_CC85A26F on CDT_SessionStudent (studentId);

create index IX_25B3DB03 on CDT_SessionTeacher (sessionId);
create index IX_89F79E4F on CDT_SessionTeacher (teacherId);

create index IX_D48B1164 on CDT_StudentHomework (homeworkId);
create index IX_EC56EA41 on CDT_StudentHomework (studentId);
create index IX_1FFC6620 on CDT_StudentHomework (studentId, homeworkId);

create index IX_F0902322 on CDT_Subject (longLabel);
create index IX_5A3CD188 on CDT_Subject (strCode);

create index IX_3E0D1B6D on CDT_TeacherGroupColor (teacherId);
create index IX_A54BE3DD on CDT_TeacherGroupColor (teacherId, groupId);

create index IX_5BFC94B6 on CDT_Visa (schoolId);
create index IX_3899419A on CDT_Visa (teacherId);

create index IX_7269752D on CDT_WeeklySchedule (schoolId);]]></indexes-sql>
</data>