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)
34 -- copy received activities to new table. only last 1m for faster migration
35 INSERT INTO received_activity (ap_id, published)