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



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

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


