diff --git a/migrations/20230426221940_init.up.sql b/migrations/20230426221940_init.up.sql index 87f293c..a0ad2da 100644 --- a/migrations/20230426221940_init.up.sql +++ b/migrations/20230426221940_init.up.sql @@ -5,15 +5,16 @@ create table if not exists witches ( id blob not null primary key, last_seen int, -- date in 64-bit unix epoch name text, - email text + email text, + secret blob not null -- encrypted password? need to figure auth out ); -- table of things to watch create table if not exists watches ( id blob not null primary key, - typ int not null, -- enum for movie or tv or whatev + typ int not null, -- enum for movie or tv show or whatev title text not null, - imdb text -- possible url for imdb entry + imdb text -- possible url for imdb or other metadata-esque site to show the user ); -- table of what people want to watch @@ -23,18 +24,20 @@ create table if not exists witch_watch ( watch blob not null, public boolean not null, watched boolean not null, + notes blob, -- per-user-show notes in some app-specific format foreign key (witch) references witches (id) on delete cascade on update no action, foreign key (watch) references watches (id) on delete cascade on update no action ); -- friend lists; this should really be a graph db, maybe the whole thing should be +-- TODO: look into replacing sqlite with https://www.cozodb.org/ create table if not exists covens ( witch blob not null primary key, - coven blob, -- possibly empty friends list in some format the application will understand + coven blob, -- possibly empty friends list in some app-specific format foreign key (witch) references witches (id) on delete cascade on update no action ); -- indices, not needed for covens -create index if not exists witch_dex on witches ( id, name, email ); -create index if not exists watch_dex on watches ( id, title, typ ); -create index if not exists ww_dex on witch_watch ( id, witch, watch ); +create index if not exists witch_dex on witches ( name, email ); +create index if not exists watch_dex on watches ( title ); +create index if not exists ww_dex on witch_watch ( witch, watch );