1 -- The Activitypub activity table
2 -- All user actions must create a row here.
3 CREATE TABLE activity (
5 user_id int REFERENCES user_ ON UPDATE CASCADE ON DELETE CASCADE NOT NULL, -- Ensures that the user is set up here.
7 local boolean NOT NULL DEFAULT TRUE,
8 published timestamp NOT NULL DEFAULT now(),
12 -- Making sure that id is unique
13 CREATE UNIQUE INDEX idx_activity_unique_apid ON activity ((data ->> 'id'::text));
15 -- Add federation columns to the two actor tables
17 -- TODO uniqueness constraints should be added on these 3 columns later
18 ADD COLUMN actor_id character varying(255) NOT NULL DEFAULT 'http://fake.com', -- This needs to be checked and updated in code, building from the site url if local
19 ADD COLUMN bio text, -- not on community, already has description
20 ADD COLUMN local boolean NOT NULL DEFAULT TRUE,
21 ADD COLUMN private_key text, -- These need to be generated from code
22 ADD COLUMN public_key text,
23 ADD COLUMN last_refreshed_at timestamp NOT NULL DEFAULT now() -- Used to re-fetch federated actor periodically
28 ADD COLUMN actor_id character varying(255) NOT NULL DEFAULT 'http://fake.com', -- This needs to be checked and updated in code, building from the site url if local
29 ADD COLUMN local boolean NOT NULL DEFAULT TRUE,
30 ADD COLUMN private_key text, -- These need to be generated from code
31 ADD COLUMN public_key text,
32 ADD COLUMN last_refreshed_at timestamp NOT NULL DEFAULT now() -- Used to re-fetch federated actor periodically
35 -- Don't worry about rebuilding the views right now.