what2watch/migrations/20240116054253_stars_and_credits.up.sql
2024-01-27 17:20:47 -08:00

20 lines
643 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 int,
died int
);
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);