DROP TABLE IF EXISTS EQUIVALENCE_PLAN_ENTRY;
CREATE TABLE EQUIVALENCE_PLAN_ENTRY (
    ID_INTERNAL int(11) not null auto_increment,
	OJB_CONCRETE_CLASS varchar(255) not null,
    KEY_ROOT_DOMAIN_OBJECT int(11) not null default 1,
	KEY_EQUIVALENCE_PLAN int(11) not null,
	KEY_NEW_CURRICULAR_COURSE int(11) null,
	KEY_COURSE_GROUP_EQUIVALENCE_PLAN_ENTRY int(11) null,
    KEY_NEW_COURSE_GROUP int(11) null,
	KEY_OLD_COURSE_GROUP int(11) null,
    primary key (ID_INTERNAL),
    index (KEY_ROOT_DOMAIN_OBJECT),
	index (KEY_EQUIVALENCE_PLAN),
	index (KEY_NEW_CURRICULAR_COURSE),
	index (KEY_COURSE_GROUP_EQUIVALENCE_PLAN_ENTRY),
	index (KEY_NEW_COURSE_GROUP),
	index (KEY_OLD_COURSE_GROUP)
) Type=InnoDB;

DROP TABLE IF EXISTS EQUIVALENCE_PLAN_ENTRY_OLD_CURRICULAR_COURSE;
DROP TABLE IF EXISTS CURRICULAR_COURSE_EQUIVALENCE_PLAN_ENTRY_OLD_CURRICULAR_COURSE;
CREATE TABLE CURRICULAR_COURSE_EQUIVALENCE_PLAN_ENTRY_OLD_CURRICULAR_COURSE (
    ID_INTERNAL int(11) not null auto_increment,
    KEY_CURRICULAR_COURSE_EQUIVALENCE_PLAN_ENTRY int(11) not null,
	KEY_CURRICULAR_COURSE int(11) not null,
    primary key (ID_INTERNAL),
	index (KEY_CURRICULAR_COURSE_EQUIVALENCE_PLAN_ENTRY),
    index (KEY_CURRICULAR_COURSE),
	unique (KEY_CURRICULAR_COURSE_EQUIVALENCE_PLAN_ENTRY, KEY_CURRICULAR_COURSE)
) Type=InnoDB;


CREATE TABLE STUDENT_CURRICULAR_PLAN_EQUIVALENCE_PLAN_ENTRY_TO_REMOVE (
	ID_INTERNAL int(11) not null auto_increment,
	KEY_STUDENT_CURRICULAR_PLAN_EQUIVALENCE_PLAN int(11) not null,
    KEY_EQUIVALENCE_PLAN_ENTRY int(11) not null,
	primary key(ID_INTERNAL),
	index (KEY_STUDENT_CURRICULAR_PLAN_EQUIVALENCE_PLAN),
	index (KEY_EQUIVALENCE_PLAN_ENTRY),
	unique (KEY_STUDENT_CURRICULAR_PLAN_EQUIVALENCE_PLAN, KEY_EQUIVALENCE_PLAN_ENTRY)
) Type=InnoDB;
