libfic: force MySQL charset
This commit is contained in:
parent
76597280f5
commit
a0737d91b9
30
libfic/db.go
30
libfic/db.go
@ -51,7 +51,7 @@ CREATE TABLE IF NOT EXISTS events(
|
|||||||
txt VARCHAR(255) NOT NULL UNIQUE,
|
txt VARCHAR(255) NOT NULL UNIQUE,
|
||||||
kind ENUM('alert-primary', 'alert-secondary', 'alert-success', 'alert-danger', 'alert-warning', 'alert-info', 'alert-light', 'alert-dark') NOT NULL,
|
kind ENUM('alert-primary', 'alert-secondary', 'alert-success', 'alert-danger', 'alert-warning', 'alert-info', 'alert-light', 'alert-dark') NOT NULL,
|
||||||
time TIMESTAMP NOT NULL
|
time TIMESTAMP NOT NULL
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS themes(
|
|||||||
id_theme INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id_theme INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
name VARCHAR(255) NOT NULL UNIQUE,
|
name VARCHAR(255) NOT NULL UNIQUE,
|
||||||
authors TEXT NOT NULL
|
authors TEXT NOT NULL
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS teams(
|
|||||||
initial_name VARCHAR(255) NOT NULL,
|
initial_name VARCHAR(255) NOT NULL,
|
||||||
name VARCHAR(255) NOT NULL,
|
name VARCHAR(255) NOT NULL,
|
||||||
color INTEGER NOT NULL
|
color INTEGER NOT NULL
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ CREATE TABLE IF NOT EXISTS team_members(
|
|||||||
nickname VARCHAR(255) NOT NULL,
|
nickname VARCHAR(255) NOT NULL,
|
||||||
company VARCHAR(255) NOT NULL,
|
company VARCHAR(255) NOT NULL,
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ CREATE TABLE IF NOT EXISTS exercices(
|
|||||||
video_uri VARCHAR(255) NOT NULL,
|
video_uri VARCHAR(255) NOT NULL,
|
||||||
FOREIGN KEY(id_theme) REFERENCES themes(id_theme),
|
FOREIGN KEY(id_theme) REFERENCES themes(id_theme),
|
||||||
FOREIGN KEY(depend) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(depend) REFERENCES exercices(id_exercice)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ CREATE TABLE IF NOT EXISTS exercice_files(
|
|||||||
cksum BINARY(64) NOT NULL,
|
cksum BINARY(64) NOT NULL,
|
||||||
size INTEGER NOT NULL,
|
size INTEGER NOT NULL,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ CREATE TABLE IF NOT EXISTS exercice_hints(
|
|||||||
content TEXT NOT NULL,
|
content TEXT NOT NULL,
|
||||||
cost INTEGER NOT NULL,
|
cost INTEGER NOT NULL,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ CREATE TABLE IF NOT EXISTS exercice_keys(
|
|||||||
type VARCHAR(255) NOT NULL,
|
type VARCHAR(255) NOT NULL,
|
||||||
cksum BINARY(64) NOT NULL,
|
cksum BINARY(64) NOT NULL,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ CREATE TABLE IF NOT EXISTS exercice_mcq(
|
|||||||
id_exercice INTEGER NOT NULL,
|
id_exercice INTEGER NOT NULL,
|
||||||
title VARCHAR(255) NOT NULL,
|
title VARCHAR(255) NOT NULL,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ CREATE TABLE IF NOT EXISTS mcq_entries(
|
|||||||
label VARCHAR(255) NOT NULL,
|
label VARCHAR(255) NOT NULL,
|
||||||
response BOOLEAN NOT NULL,
|
response BOOLEAN NOT NULL,
|
||||||
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq)
|
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ CREATE TABLE IF NOT EXISTS mcq_found(
|
|||||||
CONSTRAINT uq_found UNIQUE (id_mcq,id_team),
|
CONSTRAINT uq_found UNIQUE (id_mcq,id_team),
|
||||||
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq),
|
FOREIGN KEY(id_mcq) REFERENCES exercice_mcq(id_mcq),
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS key_found(
|
|||||||
CONSTRAINT uc_found UNIQUE (id_key,id_team),
|
CONSTRAINT uc_found UNIQUE (id_key,id_team),
|
||||||
FOREIGN KEY(id_key) REFERENCES exercice_keys(id_key),
|
FOREIGN KEY(id_key) REFERENCES exercice_keys(id_key),
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -196,7 +196,7 @@ CREATE TABLE IF NOT EXISTS exercice_solved(
|
|||||||
CONSTRAINT uc_solved UNIQUE (id_exercice,id_team),
|
CONSTRAINT uc_solved UNIQUE (id_exercice,id_team),
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice),
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice),
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ CREATE TABLE IF NOT EXISTS exercice_tries(
|
|||||||
nbdiff INTEGER NOT NULL DEFAULT 0,
|
nbdiff INTEGER NOT NULL DEFAULT 0,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice),
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice),
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ CREATE TABLE IF NOT EXISTS team_hints(
|
|||||||
CONSTRAINT uc_displayed UNIQUE (id_team,id_hint),
|
CONSTRAINT uc_displayed UNIQUE (id_team,id_hint),
|
||||||
FOREIGN KEY(id_hint) REFERENCES exercice_hints(id_hint),
|
FOREIGN KEY(id_hint) REFERENCES exercice_hints(id_hint),
|
||||||
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
FOREIGN KEY(id_team) REFERENCES teams(id_team)
|
||||||
);
|
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user