maatma: redesign pong storage, to reduce CPU and IO consumption
This commit is contained in:
parent
e6d71ee7f5
commit
656e16083d
2 changed files with 10 additions and 4 deletions
|
|
@ -114,8 +114,10 @@ CREATE TABLE IF NOT EXISTS student_challenge_errors(
|
|||
if _, err := db.Exec(`
|
||||
CREATE TABLE IF NOT EXISTS student_pong(
|
||||
id_student INTEGER NOT NULL,
|
||||
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
last TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
count INTEGER UNSIGNED DEFAULT 1,
|
||||
state BOOLEAN NOT NULL DEFAULT 0,
|
||||
CONSTRAINT one_pong UNIQUE (id_student,state),
|
||||
FOREIGN KEY(id_student) REFERENCES students(id_student)
|
||||
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
|
||||
`); err != nil {
|
||||
|
|
|
|||
Reference in a new issue