 
 
 -- -----------------------------------------------------
+-- Table `ledita-web-app`.`classificates`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `ledita-web-app`.`classificates` ;
+
+CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`classificates` (
+  `qcer_id` INT NOT NULL ,
+  `ld_id` INT NOT NULL ,
+  PRIMARY KEY (`qcer_id`, `ld_id`) ,
+  INDEX `fk_qcer_has_ld_ld1_idx` (`ld_id` ASC) ,
+  INDEX `fk_qcer_has_ld_qcer1_idx` (`qcer_id` ASC) ,
+  CONSTRAINT `fk_qcer_has_ld_qcer1`
+    FOREIGN KEY (`qcer_id` )
+    REFERENCES `ledita-web-app`.`qcer` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_qcer_has_ld_ld1`
+    FOREIGN KEY (`ld_id` )
+    REFERENCES `ledita-web-app`.`ld` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION)
+ENGINE = InnoDB;
+
+
+-- -----------------------------------------------------
 -- Table `ledita-web-app`.`needs`
 -- -----------------------------------------------------
 DROP TABLE IF EXISTS `ledita-web-app`.`needs` ;



-- -----------------------------------------------------
-- Table `ledita-web-app`.`subject`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`subject` ;



-- -----------------------------------------------------
-- Table `ledita-web-app`.`students`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`students` ;

CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`students` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `type` CHAR(1) NOT NULL COMMENT 'TYPE:\n1=ALL\n2=INDIVIDUAL\n3=PAIR\n4=GROUP' ,
  `group_number` INT UNSIGNED NULL ,
  `people_per_group` INT UNSIGNED NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ledita-web-app`.`activity`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`activity` ;

CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`activity` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `students_id` INT NOT NULL ,
  `name` VARCHAR(255) NOT NULL ,
  `type` CHAR(1) NOT NULL ,
  `duration` TIME NOT NULL DEFAULT 0 ,
  `pract_descr` VARCHAR(2000) NULL ,
  `edu_descr` VARCHAR(2000) NULL ,
  `modality` CHAR(1) NOT NULL COMMENT 'Modality:\n1=Face to face\n2=Online\n3=Blanded' ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_activity_students1_idx` (`students_id` ASC) ,
  CONSTRAINT `fk_activity_students1`
    FOREIGN KEY (`students_id` )
    REFERENCES `ledita-web-app`.`students` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ledita-web-app`.`resource`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`resource` ;

CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`resource` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `activity_id` INT NOT NULL ,
  `name` VARCHAR(50) NOT NULL ,
  `type` VARCHAR(50) NOT NULL ,
  `descr` VARCHAR(1000) NULL ,
  `link` VARCHAR(255) NULL ,
  `copy` VARCHAR(255) NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_resource_activity1_idx` (`activity_id` ASC) ,
  CONSTRAINT `fk_resource_activity1`
    FOREIGN KEY (`activity_id` )
    REFERENCES `ledita-web-app`.`activity` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ledita-web-app`.`technology`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`technology` ;

CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`technology` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(50) NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ledita-web-app`.`file`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`file` ;

CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`file` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `resource_id` INT NOT NULL ,
  `name` VARCHAR(50) NOT NULL ,
  `size` INT UNSIGNED NULL ,
  `uri` VARCHAR(255) NULL ,
  `mime` VARCHAR(50) NULL ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_file_resource1_idx` (`resource_id` ASC) ,
  CONSTRAINT `fk_file_resource1`
    FOREIGN KEY (`resource_id` )
    REFERENCES `ledita-web-app`.`resource` (`id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ledita-web-app`.`objective`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ledita-web-app`.`objective` ;
