Files can now depends on MCQ

This commit is contained in:
nemunaire 2020-01-20 17:28:37 +01:00
commit e937073588
8 changed files with 90 additions and 28 deletions

View file

@ -215,7 +215,7 @@ CREATE TABLE IF NOT EXISTS flag_choices(
return err
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS exercice_files_deps(
CREATE TABLE IF NOT EXISTS exercice_files_okey_deps(
id_file INTEGER NOT NULL,
id_flag INTEGER NOT NULL,
FOREIGN KEY(id_file) REFERENCES exercice_files(id_file),
@ -231,6 +231,16 @@ 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_files_omcq_deps(
id_file INTEGER NOT NULL,
id_mcq INTEGER NOT NULL,
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
}