lemmy/migrations/2023-08-01-115243_persistent-activity-queue/up.sql

33 lines
1.1 KiB
MySQL
Raw Normal View History

2023-08-23 16:42:50 -06:00
CREATE TYPE actor_type_enum AS enum (
2023-07-23 15:00:16 -06:00
'site',
'community',
'person'
);
-- actor_apub_id only null for old entries before this migration
2023-07-23 15:00:16 -06:00
ALTER TABLE sent_activity
ADD COLUMN send_inboxes text[] NOT NULL DEFAULT '{}', -- list of specific inbox urls
2023-08-10 10:23:24 -06:00
ADD COLUMN send_community_followers_of integer DEFAULT NULL,
ADD COLUMN send_all_instances boolean NOT NULL DEFAULT FALSE,
2023-07-23 15:00:16 -06:00
ADD COLUMN actor_type actor_type_enum NOT NULL DEFAULT 'person',
2023-07-24 08:02:15 -06:00
ADD COLUMN actor_apub_id text DEFAULT NULL;
2023-07-23 15:00:16 -06:00
ALTER TABLE sent_activity
ALTER COLUMN send_inboxes DROP DEFAULT,
ALTER COLUMN send_community_followers_of DROP DEFAULT,
ALTER COLUMN send_all_instances DROP DEFAULT,
ALTER COLUMN actor_type DROP DEFAULT,
ALTER COLUMN actor_apub_id DROP DEFAULT;
2023-07-23 15:00:16 -06:00
2023-08-23 16:42:50 -06:00
CREATE TABLE federation_queue_state (
2023-08-10 10:23:24 -06:00
id serial PRIMARY KEY,
domain varchar(255) NOT NULL UNIQUE,
2023-07-23 15:00:16 -06:00
last_successful_id bigint NOT NULL,
fail_count integer NOT NULL,
last_retry timestamptz NOT NULL
);
-- for incremental fetches of followers
2023-08-23 16:42:50 -06:00
CREATE INDEX idx_community_follower_published ON community_follower (published);
2023-07-23 15:00:16 -06:00