Implement hint dependancy on mcq

This commit is contained in:
nemunaire 2020-01-23 12:39:53 +01:00
commit 4820d42327
4 changed files with 41 additions and 7 deletions

View file

@ -184,7 +184,7 @@ CREATE TABLE IF NOT EXISTS exercice_flags(
return err
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS exercice_hints_deps(
CREATE TABLE IF NOT EXISTS exercice_hints_okey_deps(
id_hint INTEGER NOT NULL,
id_flag_dep INTEGER NOT NULL,
FOREIGN KEY(id_hint) REFERENCES exercice_hints(id_hint),
@ -241,6 +241,16 @@ CREATE TABLE IF NOT EXISTS exercice_files_omcq_deps(
FOREIGN KEY(id_file) REFERENCES exercice_files(id_file),
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return err
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS exercice_hints_omcq_deps(
id_hint INTEGER NOT NULL,
id_mcq_dep INTEGER NOT NULL,
FOREIGN KEY(id_hint) REFERENCES exercice_hints(id_hint),
FOREIGN KEY(id_mcq_dep) REFERENCES exercice_flags(id_flag)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return err
}
@ -340,7 +350,7 @@ CREATE TABLE IF NOT EXISTS exercice_tags(
id_exercice INTEGER NOT NULL,
tag VARCHAR(255) NOT NULL,
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
`); err != nil {
return err
}