-- Migration: InitAuthn
-- Created at: 17/05/2025 19:57:51

CREATE SCHEMA authn;

CREATE TABLE authn.user_identity
(
    id       uuid PRIMARY KEY,
    username text NOT NULL UNIQUE,

    password_hash bytea,
    password_salt bytea
);

CREATE TABLE authn.user_session
(
    id      varchar(256) PRIMARY KEY,
    user_id uuid        NOT NULL REFERENCES authn.user_identity (id) ON DELETE CASCADE,
    expires timestamptz NOT NULL
);
