<commit_before>"""MySQL DDL constants."""

tables = list()


# ----------------------------------------------------------------------------
# Table `Tube`
tables.append(("Tube",
               "CREATE TABLE IF NOT EXISTS `Tube` ("
               "  `TubeId` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `DiameterIn` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  `DiameterOut` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  `Length` DECIMAL(4,4) UNSIGNED NOT NULL,"
               "  `Material` VARCHAR(50) NOT NULL,"
               "  `Mass` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`TubeId`))"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Setting`
tables.append(("Setting",
               "CREATE TABLE IF NOT EXISTS `Setting` ("
               "  `SettingId` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `Duty` DECIMAL(4,1) UNSIGNED NOT NULL,"
               "  `IsMass` BIT(1) NOT NULL,"
               "  `Pressure` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `Temperature` DECIMAL(4,1) UNSIGNED NOT NULL,"
               "  `TimeStep` DECIMAL(4,2) UNSIGNED NOT NULL,"
               "  `Reservoir` BIT(1) NOT NULL,"
               "  `TubeId` TINYINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`SettingId`, `TubeId`),"
               "  INDEX `fk_Setting_Tube1_idx` (`TubeId` ASC),"
               "  CONSTRAINT `fk_Setting_Tube`"
               "    FOREIGN KEY (`TubeId`)"
               "    REFERENCES `Tube` (`TubeId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE) "
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Test`
tables.append(("Test",
               "CREATE TABLE IF NOT EXISTS `Test` ("
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `Author` VARCHAR(50) NOT NULL,"
               "  `DateTime` DATETIME NOT NULL,"
               "  `Description` VARCHAR(1000) NOT NULL,"
               "  `SettingId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`TestId`, `SettingId`),"
               "  INDEX `fk_Test_Setting_idx` (`SettingId` ASC),"
               "  CONSTRAINT `fk_Test_Setting`"
               "    FOREIGN KEY (`SettingId`)"
               "    REFERENCES `Setting` (`SettingId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Observation`
tables.append(("Observation",
               "CREATE TABLE IF NOT EXISTS `Observation` ("
               "  `CapManOk` BIT(1) NOT NULL,"
               "  `DewPoint` DECIMAL(5,2) UNSIGNED NOT NULL,"
               "  `Idx` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `Mass` DECIMAL(7,7) UNSIGNED NULL DEFAULT NULL,"
               "  `OptidewOk` BIT(1) NOT NULL,"
               "  `PowOut` DECIMAL(6,4) NULL DEFAULT NULL,"
               "  `PowRef` DECIMAL(6,4) NULL DEFAULT NULL,"
               "  `Pressure` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Idx`, `TestId`),"
               "  INDEX `fk_Observation_Test_idx` (`TestId` ASC),"
               "  CONSTRAINT `fk_Observation_Test`"
               "    FOREIGN KEY (`TestId`)"
               "    REFERENCES `Test` (`TestId`)"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `TempObservation`
tables.append(("TempObservation",
               "CREATE TABLE IF NOT EXISTS `TempObservation` ("
               "  `ThermocoupleNum` TINYINT(2) UNSIGNED NOT NULL,"
               "  `Temperature` DECIMAL(5,2) NOT NULL,"
               "  `Idx` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Idx`, `TestId`, `ThermocoupleNum`),"
               "  CONSTRAINT `fk_TempObservation_Observation`"
               "    FOREIGN KEY (`Idx` , `TestId`)"
               "    REFERENCES `Observation` (`Idx` , `TestId`)"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))

# -- -----------------------------------------------------
# -- Table `RHTargets`
tables.append(("RHTargets",
               "  CREATE TABLE IF NOT EXISTS `RHTargets` ("
               "  `RH` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`RH`, `TestId`),"
               "  INDEX `fk_RHTargets_Test_idx` (`TestId` ASC),"
               "  CONSTRAINT `fk_RHTargets_Test`"
               "    FOREIGN KEY (`TestId`)"
               "    REFERENCES `Test` (`TestId`)"
               "    ON UPDATE CASCADE)"
               " ENGINE = InnoDB;"))

# -- -----------------------------------------------------
# -- Table `Results`
tables.append(("Results",
               "  CREATE TABLE IF NOT EXISTS `Results` ("
               "  `RH` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  `A` FLOAT NOT NULL,"
               "  `SigA` FLOAT UNSIGNED NOT NULL,"
               "  `B` FLOAT NOT NULL,"
               "  `SigB` FLOAT UNSIGNED NOT NULL,"
               "  `Chi2` FLOAT UNSIGNED NOT NULL,"
               "  `Q` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `Nu` SMALLINT UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Nu`, `RH`, `TestId`),"
               "  CONSTRAINT `fk_Results_RHTargets1`"
               "    FOREIGN KEY (`RH` , `TestId`)"
               "    REFERENCES `RHTargets` (`RH` , `TestId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE)"<commit_msg>Adds Delete Restrict statement to RHTargets ddl<commit_after>"""MySQL DDL constants."""

tables = list()


# ----------------------------------------------------------------------------
# Table `Tube`
tables.append(("Tube",
               "CREATE TABLE IF NOT EXISTS `Tube` ("
               "  `TubeId` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `DiameterIn` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  `DiameterOut` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  `Length` DECIMAL(4,4) UNSIGNED NOT NULL,"
               "  `Material` VARCHAR(50) NOT NULL,"
               "  `Mass` DECIMAL(7,7) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`TubeId`))"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Setting`
tables.append(("Setting",
               "CREATE TABLE IF NOT EXISTS `Setting` ("
               "  `SettingId` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `Duty` DECIMAL(4,1) UNSIGNED NOT NULL,"
               "  `IsMass` BIT(1) NOT NULL,"
               "  `Pressure` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `Temperature` DECIMAL(4,1) UNSIGNED NOT NULL,"
               "  `TimeStep` DECIMAL(4,2) UNSIGNED NOT NULL,"
               "  `Reservoir` BIT(1) NOT NULL,"
               "  `TubeId` TINYINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`SettingId`, `TubeId`),"
               "  INDEX `fk_Setting_Tube1_idx` (`TubeId` ASC),"
               "  CONSTRAINT `fk_Setting_Tube`"
               "    FOREIGN KEY (`TubeId`)"
               "    REFERENCES `Tube` (`TubeId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE) "
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Test`
tables.append(("Test",
               "CREATE TABLE IF NOT EXISTS `Test` ("
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,"
               "  `Author` VARCHAR(50) NOT NULL,"
               "  `DateTime` DATETIME NOT NULL,"
               "  `Description` VARCHAR(1000) NOT NULL,"
               "  `SettingId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`TestId`, `SettingId`),"
               "  INDEX `fk_Test_Setting_idx` (`SettingId` ASC),"
               "  CONSTRAINT `fk_Test_Setting`"
               "    FOREIGN KEY (`SettingId`)"
               "    REFERENCES `Setting` (`SettingId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `Observation`
tables.append(("Observation",
               "CREATE TABLE IF NOT EXISTS `Observation` ("
               "  `CapManOk` BIT(1) NOT NULL,"
               "  `DewPoint` DECIMAL(5,2) UNSIGNED NOT NULL,"
               "  `Idx` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `Mass` DECIMAL(7,7) UNSIGNED NULL DEFAULT NULL,"
               "  `OptidewOk` BIT(1) NOT NULL,"
               "  `PowOut` DECIMAL(6,4) NULL DEFAULT NULL,"
               "  `PowRef` DECIMAL(6,4) NULL DEFAULT NULL,"
               "  `Pressure` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Idx`, `TestId`),"
               "  INDEX `fk_Observation_Test_idx` (`TestId` ASC),"
               "  CONSTRAINT `fk_Observation_Test`"
               "    FOREIGN KEY (`TestId`)"
               "    REFERENCES `Test` (`TestId`)"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))


# ----------------------------------------------------------------------------
# Table `TempObservation`
tables.append(("TempObservation",
               "CREATE TABLE IF NOT EXISTS `TempObservation` ("
               "  `ThermocoupleNum` TINYINT(2) UNSIGNED NOT NULL,"
               "  `Temperature` DECIMAL(5,2) NOT NULL,"
               "  `Idx` MEDIUMINT(6) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Idx`, `TestId`, `ThermocoupleNum`),"
               "  CONSTRAINT `fk_TempObservation_Observation`"
               "    FOREIGN KEY (`Idx` , `TestId`)"
               "    REFERENCES `Observation` (`Idx` , `TestId`)"
               "    ON UPDATE CASCADE)"
               "  ENGINE = InnoDB"
               "  DEFAULT CHARACTER SET = latin1;"))

# -- -----------------------------------------------------
# -- Table `RHTargets`
tables.append(("RHTargets",
               "  CREATE TABLE IF NOT EXISTS `RHTargets` ("
               "  `RH` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`RH`, `TestId`),"
               "  INDEX `fk_RHTargets_Test_idx` (`TestId` ASC),"
               "  CONSTRAINT `fk_RHTargets_Test`"
               "    FOREIGN KEY (`TestId`)"
               "    REFERENCES `Test` (`TestId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE)"
               " ENGINE = InnoDB;"))

# -- -----------------------------------------------------
# -- Table `Results`
tables.append(("Results",
               "  CREATE TABLE IF NOT EXISTS `Results` ("
               "  `RH` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `TestId` SMALLINT(3) UNSIGNED NOT NULL,"
               "  `A` FLOAT NOT NULL,"
               "  `SigA` FLOAT UNSIGNED NOT NULL,"
               "  `B` FLOAT NOT NULL,"
               "  `SigB` FLOAT UNSIGNED NOT NULL,"
               "  `Chi2` FLOAT UNSIGNED NOT NULL,"
               "  `Q` DECIMAL(3,2) UNSIGNED NOT NULL,"
               "  `Nu` SMALLINT UNSIGNED NOT NULL,"
               "  PRIMARY KEY (`Nu`, `RH`, `TestId`),"
               "  CONSTRAINT `fk_Results_RHTargets1`"
               "    FOREIGN KEY (`RH` , `TestId`)"
               "    REFERENCES `RHTargets` (`RH` , `TestId`)"
               "    ON DELETE RESTRICT"
               "    ON UPDATE CASCADE)"
{'fraction_non_alphanumeric': 0.19528997116308874, 'fraction_numerical': 0.01025312399871836, 'mean_word_length': 1.2920873875527814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6675394', 'n_tokens_mistral': 4054, 'n_tokens_neox': 3694, 'n_words': 872}