teacher-tools/api/schema/auth.sql

12 lines
440 B
SQL

CREATE TABLE auth_user (
id BIGSERIAL PRIMARY KEY,
username VARCHAR(64) NOT NULL UNIQUE
CONSTRAINT username_check CHECK (LENGTH(username) >= 3),
password_hash VARCHAR(255) NOT NULL
CONSTRAINT password_check CHECK (LENGTH(password_hash) >= 32),
created_at BIGINT NOT NULL
DEFAULT EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000,
is_locked BOOLEAN NOT NULL DEFAULT FALSE,
is_admin BOOLEAN NOT NULL DEFAULT FALSE
);