     ON UPDATE CASCADE)
 ENGINE = InnoDB;
 
+
+-- -----------------------------------------------------
+-- Table `ledita-web-app`.`composes`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `ledita-web-app`.`composes` ;
+
+CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`composes` (
+  `id` INT NOT NULL ,
+  `ld_id` INT NOT NULL ,
+  `activity_id` INT NULL ,
+  `ld_part_id` INT NULL ,
+  `activity_group_id` INT NULL ,
+  `order` INT UNSIGNED NULL ,
+  INDEX `fk_activity_has_ld_ld1_idx` (`ld_id` ASC) ,
+  INDEX `fk_activity_has_ld_activity1_idx` (`activity_id` ASC) ,
+  INDEX `fk_composes_activity_group1_idx` (`activity_group_id` ASC) ,
+  INDEX `fk_ld_is_part_of_ld1_idx` (`ld_part_id` ASC) ,
+  PRIMARY KEY (`id`) ,
+  CONSTRAINT `fk_activity_has_ld_activity1`
+    FOREIGN KEY (`activity_id` )
+    REFERENCES `ledita-web-app`.`activity` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_activity_has_ld_ld1`
+    FOREIGN KEY (`ld_id` )
+    REFERENCES `ledita-web-app`.`ld` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_composes_activity_group1`
+    FOREIGN KEY (`activity_group_id` )
+    REFERENCES `ledita-web-app`.`activity_group` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_ld_is_part_of_ld1`
+    FOREIGN KEY (`ld_part_id` )
+    REFERENCES `ledita-web-app`.`ld` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION)
+ENGINE = InnoDB;
+
+
+-- -----------------------------------------------------
+-- Table `ledita-web-app`.`participates`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `ledita-web-app`.`participates` ;
+
+CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`participates` (
+  `id` INT NOT NULL ,
+  `activity_group_id` INT NOT NULL ,
+  `activity_id` INT NULL ,
+  `ld_is_part_id` INT NULL ,
+  PRIMARY KEY (`id`) ,
+  INDEX `fk_activity_has_activity_group_activity_group1_idx` (`activity_group_id` ASC) ,
+  INDEX `fk_activity_has_activity_group_activity1_idx` (`activity_id` ASC) ,
+  INDEX `fk_ld_has_acitivty_group_idx` (`ld_is_part_id` ASC) ,
+  CONSTRAINT `fk_activity_has_activity_group_activity1`
+    FOREIGN KEY (`activity_id` )
+    REFERENCES `ledita-web-app`.`activity` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_activity_has_activity_group_activity_group1`
+    FOREIGN KEY (`activity_group_id` )
+    REFERENCES `ledita-web-app`.`activity_group` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_ld_has_acitivty_group`
+    FOREIGN KEY (`ld_is_part_id` )
+    REFERENCES `ledita-web-app`.`ld` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION)
+ENGINE = InnoDB;
+
+
+-- -----------------------------------------------------
+-- Table `ledita-web-app`.`supports`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `ledita-web-app`.`supports` ;
+
+CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`supports` (
+  `technology_id` INT NOT NULL ,
+  `activity_id` INT NOT NULL ,
+  PRIMARY KEY (`technology_id`, `activity_id`) ,
+  INDEX `fk_technology_has_activity_activity1_idx` (`activity_id` ASC) ,
+  INDEX `fk_technology_has_activity_technology1_idx` (`technology_id` ASC) ,
+  CONSTRAINT `fk_technology_has_activity_technology1`
+    FOREIGN KEY (`technology_id` )
+    REFERENCES `ledita-web-app`.`technology` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_technology_has_activity_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`.`describes`
+-- -----------------------------------------------------
+DROP TABLE IF EXISTS `ledita-web-app`.`describes` ;
+
+CREATE  TABLE IF NOT EXISTS `ledita-web-app`.`describes` (
+  `id` INT NOT NULL AUTO_INCREMENT ,
+  `tag_id` INT NOT NULL ,
+  `comment_id` INT NULL ,
+  `activity_id` INT NULL ,
+  PRIMARY KEY (`id`) ,
+  INDEX `fk_activity_has_tag_tag1_idx` (`tag_id` ASC) ,
+  INDEX `fk_describes_comment1_idx` (`comment_id` ASC) ,
+  INDEX `fk_describes_activity1_idx` (`activity_id` ASC) ,
+  CONSTRAINT `fk_activity_has_tag_tag1`
+    FOREIGN KEY (`tag_id` )
+    REFERENCES `ledita-web-app`.`tag` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_describes_comment1`
+    FOREIGN KEY (`comment_id` )
+    REFERENCES `ledita-web-app`.`comment` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION,
+  CONSTRAINT `fk_describes_activity1`
+    FOREIGN KEY (`activity_id` )
+    REFERENCES `ledita-web-app`.`activity` (`id` )
+    ON DELETE NO ACTION
+    ON UPDATE NO ACTION)
+ENGINE = InnoDB;
+
 USE `ledita-web-app` ;
 
 

  `id` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(100) NULL ,
  PRIMARY KEY (`id`) )
ENGINE = InnoDB;





-- -----------------------------------------------------
-- 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` ;
