CREATE TABLE IF NOT EXISTS problem (
    id          INTEGER PRIMARY KEY,
    title       TEXT NOT NULL,
    description TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS user (
    id            INTEGER PRIMARY KEY,
    email         TEXT UNIQUE NOT NULL,
    username      TEXT UNIQUE NOT NULL,
    password_hash TEXT NOT NULL,
    is_admin      INTEGER NOT NULL
);

CREATE TABLE IF NOT EXISTS submission (
    id          INTEGER PRIMARY KEY,
    user_id     INTEGER NOT NULL,
    problem_id  INTEGER NOT NULL,
    language    TEXT NOT NULL,
    details     TEXT NOT NULL,
    code        TEXT NOT NULL,
    code_length INTEGER NOT NULL
);
