CREATE TABLE IF NOT EXISTS link (
    id UUID PRIMARY KEY,
    slug TEXT UNIQUE NOT NULL,
    destination TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS file (
    id UUID PRIMARY KEY,
    hash BYTEA UNIQUE NOT NULL,
    mime TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS file_key (
    id UUID PRIMARY KEY,
    file_id UUID REFERENCES file (id) ON DELETE CASCADE NOT NULL
);
