summaryrefslogtreecommitdiffstats
path: root/migrations/20250713161354_account.sql
blob: 4fdb61d47b673f7fa44b1cf85877279982c494c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
create table account (
    id varchar(36) primary key,
    username varchar(30) not null,
    inbox text not null,
    outbox text,
    local boolean,
    ap_id text not null unique,
    private_key text,
    public_key text not null
);

create table following (
    id varchar(36) 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;