Implement label only flag
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b98e23d060
commit
01b05aaed0
9 changed files with 311 additions and 11 deletions
32
libfic/db.go
32
libfic/db.go
|
@ -198,6 +198,18 @@ 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_flag_labels(
|
||||
id_label INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
id_exercice INTEGER NOT NULL,
|
||||
ordre TINYINT NOT NULL,
|
||||
label VARCHAR(255) NOT NULL,
|
||||
variant VARCHAR(255) NOT NULL,
|
||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -218,6 +230,16 @@ CREATE TABLE IF NOT EXISTS exercice_flags_deps(
|
|||
FOREIGN KEY(id_flag) REFERENCES exercice_flags(id_flag),
|
||||
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_flag_labels_deps(
|
||||
id_label INTEGER NOT NULL,
|
||||
id_flag_dep INTEGER NOT NULL,
|
||||
FOREIGN KEY(id_label) REFERENCES exercice_flag_labels(id_label),
|
||||
FOREIGN KEY(id_flag_dep) REFERENCES exercice_flags(id_flag)
|
||||
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -290,6 +312,16 @@ CREATE TABLE IF NOT EXISTS exercice_flags_omcq_deps(
|
|||
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
|
||||
}
|
||||
if _, err := db.Exec(`
|
||||
CREATE TABLE IF NOT EXISTS exercice_flag_labels_omcq_deps(
|
||||
id_label INTEGER NOT NULL,
|
||||
id_mcq_dep INTEGER NOT NULL,
|
||||
FOREIGN KEY(id_label) REFERENCES exercice_flag_labels(id_label),
|
||||
FOREIGN KEY(id_mcq_dep) REFERENCES exercice_mcq(id_mcq)
|
||||
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||
`); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Reference in a new issue