···530 unique (repo_at, label_at)
531 );
5320000000000000000000000000000533 create table if not exists migrations (
534 id integer primary key autoincrement,
535 name text unique
536 );
537538- -- indexes for better star query performance
00539 create index if not exists idx_stars_created on stars(created);
540 create index if not exists idx_stars_repo_at_created on stars(repo_at, created);
541 `)
···530 unique (repo_at, label_at)
531 );
532533+ create table if not exists notifications (
534+ id integer primary key autoincrement,
535+ recipient_did text not null,
536+ actor_did text not null,
537+ type text not null,
538+ entity_type text not null,
539+ entity_id text not null,
540+ read integer not null default 0,
541+ created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
542+ repo_id integer references repos(id),
543+ issue_id integer references issues(id),
544+ pull_id integer references pulls(id)
545+ );
546+547+ create table if not exists notification_preferences (
548+ id integer primary key autoincrement,
549+ user_did text not null unique,
550+ repo_starred integer not null default 1,
551+ issue_created integer not null default 1,
552+ issue_commented integer not null default 1,
553+ pull_created integer not null default 1,
554+ pull_commented integer not null default 1,
555+ followed integer not null default 1,
556+ pull_merged integer not null default 1,
557+ issue_closed integer not null default 1,
558+ email_notifications integer not null default 0
559+ );
560+561 create table if not exists migrations (
562 id integer primary key autoincrement,
563 name text unique
564 );
565566+ -- indexes for better performance
567+ create index if not exists idx_notifications_recipient_created on notifications(recipient_did, created desc);
568+ create index if not exists idx_notifications_recipient_read on notifications(recipient_did, read);
569 create index if not exists idx_stars_created on stars(created);
570 create index if not exists idx_stars_repo_at_created on stars(repo_at, created);
571 `)