create table account ( id uuid primary key, username varchar(30) not null, inbox text not null, outbox text, local boolean not null, ap_id text not null unique, private_key text, public_key text not null ); create table following ( id uuid primary key, follower text references account(ap_id) on delete cascade, followee text references account(ap_id) on delete cascade, created_at timestamptz not null default now(), constraint unique_following unique (follower, followee) ); create index "following_pagination" on "following" ("created_at" asc); create unique index unique_username_local on account (username) where local = true;