CREATE TYPE session_kind AS ENUM ('api', 'user');

ALTER TABLE user_session
    ADD COLUMN IF NOT EXISTS "created" timestamptz NOT NULL DEFAULT NOW(),
    ADD COLUMN IF NOT EXISTS "csrf" UUID NOT NULL DEFAULT gen_random_uuid(),
    ADD COLUMN IF NOT EXISTS "name" VARCHAR(255),
    ADD COLUMN IF NOT EXISTS kind session_kind NOT NULL DEFAULT 'user';

CREATE TABLE IF NOT EXISTS user_profile_pic (
    username VARCHAR(255) NOT NULL PRIMARY KEY,
    "image" bytea NOT NULL,
    FOREIGN KEY (username) REFERENCES users(username)
);
