libfic: implement more dependancies kind

This commit is contained in:
nemunaire 2019-01-16 06:02:06 +01:00
commit 5d31ac6e04
5 changed files with 93 additions and 8 deletions

View file

@ -216,6 +216,26 @@ CREATE TABLE IF NOT EXISTS exercice_mcq(
title VARCHAR(255) 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_mcq_okey_deps(
id_mcq INTEGER NOT NULL,
id_flag_dep INTEGER NOT NULL,
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq),
FOREIGN KEY(id_flag_dep) REFERENCES exercice_flags(id_flag)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return err
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS exercice_flags_omcq_deps(
id_flag INTEGER NOT NULL,
id_mcq_dep INTEGER NOT NULL,
FOREIGN KEY(id_flag) REFERENCES exercice_flags(id_flag),
FOREIGN KEY(id_mcq_dep) REFERENCES exercice_mcq(id_mcq)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return err
}