ALTER TABLE ENROLMENT RENAME CURRICULUM_MODULE;
ALTER TABLE CURRICULUM_MODULE DROP KEY_CURRICULAR_COURSE_FOR_OPTION;
ALTER TABLE CURRICULUM_MODULE DROP INDEX KEY_CURRICULAR_COURSE_FOR_OPTION;
ALTER TABLE CURRICULUM_MODULE CHANGE KEY_CURRICULAR_COURSE KEY_DEGREE_MODULE int(11) DEFAULT NULL;
ALTER TABLE CURRICULUM_MODULE ADD KEY_CURRICULUM_GROUP int(11) DEFAULT NULL;
ALTER TABLE CURRICULUM_MODULE ADD GIVEN_CREDITS int(11) DEFAULT NULL;
ALTER TABLE CURRICULUM_MODULE ADD INDEX KEY_CURRICULUM_GROUP (KEY_CURRICULUM_GROUP);
ALTER TABLE CURRICULUM_MODULE ADD INDEX KEY_DEGREE_MODULE (KEY_DEGREE_MODULE);
CREATE TABLE CREDITS_ENROLMENT (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  KEY_CREDITS int(11) NOT NULL default '0',
  KEY_ENROLMENT int(11) NOT NULL default '0',
  PRIMARY KEY  (ID_INTERNAL),
  UNIQUE KEY U1 (KEY_CREDITS,KEY_ENROLMENT),
  KEY KEY_CREDITS (KEY_CREDITS),
  KEY KEY_ENROLMENT (KEY_ENROLMENT)
) ENGINE=InnoDB;
CREATE TABLE EQUIVALENT_ENROLMENT (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  KEY_EQUIVALENT int(11) NOT NULL default '0',
  KEY_ENROLMENT int(11) NOT NULL default '0',
  PRIMARY KEY  (ID_INTERNAL),
  UNIQUE KEY U1 (KEY_EQUIVALENT,KEY_ENROLMENT),
  KEY KEY_EQUIVALENT (KEY_EQUIVALENT),
  KEY KEY_ENROLMENT (KEY_ENROLMENT)
) ENGINE=InnoDB;

CREATE TABLE EQUIVALENCE_CURRICULAR_COURSE_CURRICULAR_COURSE (
  ID_INTERNAL int(11) NOT NULL auto_increment,
  KEY_CURRICULAR_COURSE_OLD_CURRICULAR_COURSES int(11) NOT NULL default '0',
  KEY_CURRICULAR_COURSE_EQUIVALENT_CURRICULAR_COURSES int(11) NOT NULL default '0',
  PRIMARY KEY  (ID_INTERNAL),
  UNIQUE KEY U1 (KEY_CURRICULAR_COURSE_OLD_CURRICULAR_COURSES,KEY_CURRICULAR_COURSE_EQUIVALENT_CURRICULAR_COURSES),
  KEY KEY_EQUIVALENT (KEY_CURRICULAR_COURSE_OLD_CURRICULAR_COURSES),
  KEY KEY_ENROLMENT (KEY_CURRICULAR_COURSE_EQUIVALENT_CURRICULAR_COURSES)
) ENGINE=InnoDB;
