what2watch/migrations/20240116054253_stars_and_cr...

21 lines
645 B
SQL

create table if not exists stars (
id blob not null primary key default (julid_new()),
name text not null,
metadata_url text,
born text,
died text
);
create index if not exists stars_name_dex on stars (lower(name));
-- as in screen credits for a movie
create table if not exists credits (
star blob not null,
watch blob not null,
credit text, -- "actor", "director", whatevs
unique (star, watch, credit),
foreign key (star) references stars (id),
foreign key (watch) references watches (id)
);
create index if not exists credits_star_dex on credits (star);
create index if not exists credits_watch_dex on credits (watch);