CREATE TABLE items (
    inode           BIGINT PRIMARY KEY,
    name            TEXT NOT NULL,
    original_path   TEXT NOT NULL,
    local_path      TEXT NOT NULL,
    file_type       TEXT NOT NULL CHECK (file_type IN ('directory', 'file')),
    hash            BIGINT NOT NULL
);

CREATE TABLE music_metadata (
    inode           BIGINT PRIMARY KEY REFERENCES items(inode) ON DELETE CASCADE,
    track_title     TEXT NOT NULL,
    album           TEXT NOT NULL,
    track_number    INTEGER NOT NULL
);

CREATE TABLE music_metadata_artists (
    inode           BIGINT NOT NULL REFERENCES music_metadata(inode) ON DELETE CASCADE,
    artist          TEXT NOT NULL
);
