
create table ices2_playlist (
    ipl_date_ins        TIMESTAMP(0)    not null,
    ipl_seq_nr          integer         not null,
    ipl_directory       varchar(256)    not null,
    ipl_name            varchar(256)    not null,
    ipl_date_start      TIMESTAMP(0)    null,
    ipl_date_end        TIMESTAMP(0)    null,
    constraint ices2_playlist_pk primary key (
        ipl_date_ins, ipl_seq_nr
    )
);

create index ices2_playlist_idx on ices2_playlist (
    ipl_date_ins, ipl_seq_nr, ipl_date_start
);

create table ices2_oggfiles (
    iof_directory       varchar(256)    not null,
    iof_name            varchar(256)    not null,
    iof_is_file         boolean         not null,
    iof_title           varchar(128)    null,
    iof_artist          varchar(128)    null,
    iof_album           varchar(128)    null,
    iof_track_nr        integer         null,
    iof_genre           varchar(128)    null,
    iof_length          integer         null,
    iof_bitrate         integer         null,
    iof_filesize        integer         null,
    iof_date_mod        TIMESTAMP(0)    null,
    constraint ices2_oggfiles_pk primary key (
        iof_directory, iof_name
    )
);

grant select, insert, update, delete on ices2_playlist to "www-data";
grant select, insert, update, delete on ices2_oggfiles to "www-data";

