sync: implement hint dependency on flags

This commit is contained in:
nemunaire 2019-10-26 11:33:30 +02:00
commit 6740256a32
6 changed files with 72 additions and 2 deletions

View file

@ -179,6 +179,16 @@ CREATE TABLE IF NOT EXISTS exercice_flags(
choices_cost INTEGER NOT NULL,
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
`); err != nil {
return err
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS exercice_hints_deps(
id_hint INTEGER NOT NULL,
id_flag_dep INTEGER NOT NULL,
FOREIGN KEY(id_hint) REFERENCES exercice_hints(id_hint),
FOREIGN KEY(id_flag_dep) REFERENCES exercice_flags(id_flag)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return err
}