CREATE TABLE IF NOT EXISTS movies (
    title              TEXT NOT NULL,
    year               INTEGER NOT NULL,
    size               INTEGER NOT NULL,
    hash               TEXT NOT NULL,
    tmdb_id            INTEGER NULL DEFAULT NULL,
    audio_languages    TEXT NULL DEFAULT NULL,
    subtitle_languages TEXT NULL DEFAULT NULL,
    resolution         TEXT NULL DEFAULT NULL,
    dynamic_range      TEXT NULL DEFAULT NULL,
    bitrate            INTEGER NULL DEFAULT NULL,
    user               TEXT NULL DEFAULT NULL,
    PRIMARY KEY (title, year, size, hash)
);

CREATE TABLE IF NOT EXISTS users (
    name TEXT NOT NULL PRIMARY KEY,
    hash TEXT NOT NULL,
    salt TEXT NOT NULL DEFAULT ''
);
