2023-12-02 01:38:57 +00:00
|
|
|
create table instance (
|
|
|
|
id serial primary key,
|
|
|
|
ap_id varchar(255) not null unique,
|
|
|
|
inbox_url text not null,
|
|
|
|
articles_url varchar(255) not null unique,
|
|
|
|
public_key text not null,
|
|
|
|
private_key text,
|
|
|
|
last_refreshed_at timestamptz not null default now(),
|
|
|
|
local bool not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table instance_follow (
|
|
|
|
id serial primary key,
|
2023-12-04 14:10:07 +00:00
|
|
|
instance_id int REFERENCES instance ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
2023-12-02 01:38:57 +00:00
|
|
|
follower_id int REFERENCES instance ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
2023-12-04 14:10:07 +00:00
|
|
|
pending boolean not null,
|
|
|
|
unique(instance_id, follower_id)
|
2023-12-02 01:38:57 +00:00
|
|
|
);
|
2023-12-04 14:10:07 +00:00
|
|
|
|
2023-11-29 15:41:29 +00:00
|
|
|
create table article (
|
|
|
|
id serial primary key,
|
|
|
|
title text not null,
|
|
|
|
text text not null,
|
2023-12-01 11:11:19 +00:00
|
|
|
ap_id varchar(255) not null unique,
|
2023-12-02 01:38:57 +00:00
|
|
|
instance_id int REFERENCES instance ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
2023-11-29 15:41:29 +00:00
|
|
|
local bool not null
|
|
|
|
);
|
|
|
|
|
|
|
|
create table edit (
|
|
|
|
id serial primary key,
|
2023-12-01 11:11:19 +00:00
|
|
|
ap_id varchar(255) not null unique,
|
2023-11-29 15:41:29 +00:00
|
|
|
diff text not null,
|
|
|
|
article_id int REFERENCES article ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
|
|
|
|
version text not null,
|
2023-12-01 15:07:22 +00:00
|
|
|
previous_version text not null
|
2023-11-29 15:41:29 +00:00
|
|
|
)
|