token-validator: record logins

This commit is contained in:
nemunaire 2018-02-22 05:36:46 +01:00 committed by Pierre-Olivier Mercier
commit 843aac8d54
2 changed files with 38 additions and 7 deletions

View file

@ -58,12 +58,23 @@ CREATE TABLE IF NOT EXISTS students(
login VARCHAR(255) NOT NULL UNIQUE,
time TIMESTAMP NOT NULL
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return
}
if _, err = db.Exec(`
CREATE TABLE IF NOT EXISTS student_keys(
id_key INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_student INTEGER NOT NULL,
sshkey TEXT,
time TIMESTAMP NOT NULL,
FOREIGN KEY(id_student) REFERENCES students(id_student)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_bin;
`); err != nil {
return
}
if _, err := db.Exec(`
CREATE TABLE IF NOT EXISTS student_login(
id_student INTEGER,
id_student INTEGER NOT NULL,
ip VARCHAR(255) NOT NULL,
mac VARCHAR(255) NOT NULL,
time TIMESTAMP NOT NULL,