begin transaction;

create table songs(
    path text not null primary key,
    artist text,
    album text,
    last_queued timestamp with time zone,
    generation bigint not null);

create index songs_artist_idx on songs(artist);
create index songs_album_idx on songs(album);

create table albums(
    artist text not null,
    album text not null,
    last_queued timestamp with time zone,
    generation bigint not null,
    primary key(album,artist));

create table artists(
    artist text not null primary key,
    last_queued timestamp with time zone,
    generation bigint not null);

create table unwanted_albums(
    artist text not null,
    album text not null,
    generation bigint not null,
    primary key(album,artist));

create table unwanted_artists(
    artist text not null primary key,
    generation bigint not null
);

create table options(
    generation bigint not null
);

insert into options(generation) values(0);

commit;
