-- note: sqlite-specific migration due to the types of the columns -- users 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, 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 show or whatev title text not null, imdb text -- possible url for imdb or other metadata-esque site to show the user ); -- table of what people want to watch create table if not exists witch_watch ( id blob not null primary key, witch blob not null, 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 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 ( name, email ); create index if not exists watch_dex on watches ( title ); create index if not exists ww_dex on witch_watch ( witch, watch );