CREATE TABLE IF NOT EXISTS Users (
    -- for foreign key relations
    user_id SERIAL PRIMARY KEY,
    -- Public key posted next to display name; never changes
    pub VARCHAR(255),
    -- Private key used by user to login
    priv VARCHAR(4096),
    display_name VARCHAR(255)
);

CREATE TABLE IF NOT EXISTS UserRooms (
    user_id INTEGER,
    room_id INTEGER
);

CREATE TABLE IF NOT EXISTS Rooms (
    room_id SERIAL PRIMARY KEY,

    display_name VARCHAR(255)
);

CREATE UNIQUE INDEX IF NOT EXISTS display_name_idx ON Rooms (display_name);

CREATE TABLE IF NOT EXISTS UserVote (
    user_id INTEGER,
    imdb_title VARCHAR(255),

    rank INTEGER
);