Files
huntingclubroster/migrations/005_security_capacity.sql

21 lines
860 B
SQL

CREATE TABLE IF NOT EXISTS user_mfa (
user_serial BIGINT UNSIGNED NOT NULL PRIMARY KEY,
secret_cipher TEXT NOT NULL,
last_counter BIGINT NOT NULL DEFAULT -1,
FOREIGN KEY (user_serial) REFERENCES users(user_serial) ON DELETE CASCADE
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS mfa_recovery (
user_serial BIGINT UNSIGNED NOT NULL,
code_hash CHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
PRIMARY KEY(user_serial,code_hash),
FOREIGN KEY (user_serial) REFERENCES users(user_serial) ON DELETE CASCADE
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS club_resource_usage (
club_serial BIGINT UNSIGNED NOT NULL,
resource_name VARCHAR(32) NOT NULL,
window_started DATETIME NOT NULL,
used_count INT UNSIGNED NOT NULL,
PRIMARY KEY(club_serial,resource_name),
FOREIGN KEY (club_serial) REFERENCES clubs(club_serial) ON DELETE RESTRICT
) ENGINE=InnoDB;