1 -- outgoing activities, need to be stored to be later server over http
2 -- we change data column from jsonb to json for decreased size
3 -- https://stackoverflow.com/a/22910602
4 create table sent_activity (
5 id bigserial primary key,
6 ap_id text unique not null,
8 sensitive boolean not null,
9 published timestamp not null default now()
12 -- incoming activities, we only need the id to avoid processing the same activity multiple times
13 create table received_activity (
14 id bigserial primary key,
15 ap_id text unique not null,
16 published timestamp not null default now()
19 -- copy sent activities to new table. only copy last 100k for faster migration
20 insert into sent_activity(ap_id, data, sensitive, published)
21 select ap_id, data, sensitive, published
27 -- copy received activities to new table. only last 1m for faster migration
28 insert into received_activity(ap_id, published)
29 select ap_id, published