CREATE TABLE IF NOT EXISTS "user" (
    id UUID NOT NULL,
    pseudo VARCHAR(256) NOT NULL,
    email VARCHAR(256) NOT NULL,
    encrypted_password VARCHAR(512) NOT NULL,
    CONSTRAINT user_pk PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS user_roles (
    user_id UUID NOT NULL,
    role SMALLINT NOT NULL,
    CONSTRAINT user_roles_pk PRIMARY KEY (user_id, role),
    CONSTRAINT user_roles_user_id_fk FOREIGN KEY (user_id) REFERENCES "user" (id)
);
CREATE INDEX IF NOT EXISTS user_roles_user_id_idx ON user_roles (user_id);

