lemmy/migrations/2023-08-01-115243_persisten.../up.sql

33 lines
1.1 KiB
MySQL
Raw Normal View History

Persistent, performant, reliable federation queue (#3605) * persistent activity queue * fixes * fixes * make federation workers function callable from outside * log federation instances * dead instance detection not needed here * taplo fmt * split federate bin/lib * minor fix * better logging * log * create struct to hold cancellable task for readability * use boxfuture for readability * reset submodule * fix * fix lint * swap * remove json column, use separate array columns instead * some review comments * make worker a struct for readability * minor readability * add local filter to community follower view * remove separate lemmy_federate entry point * fix remaining duration * address review comments mostly * fix lint * upgrade actitypub-fed to simpler interface * fix sql format * increase delays a bit * fixes after merge * remove selectable * fix instance selectable * add comment * start federation based on latest id at the time * rename federate process args * dead instances in one query * filter follow+report activities by local * remove synchronous federation remove activity sender queue * lint * fix federation tests by waiting for results to change * fix fed test * fix comment report * wait some more * Apply suggestions from code review Co-authored-by: SorteKanin <sortekanin@gmail.com> * fix most remaining tests * wait until private messages * fix community tests * fix community tests * move arg parse * use instance_id instead of domain in federation_queue_state table --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: SorteKanin <sortekanin@gmail.com>
2023-09-09 16:25:03 +00:00
CREATE TYPE actor_type_enum AS enum (
'site',
'community',
'person'
);
-- actor_apub_id only null for old entries before this migration
ALTER TABLE sent_activity
ADD COLUMN send_inboxes text[] NOT NULL DEFAULT '{}', -- list of specific inbox urls
ADD COLUMN send_community_followers_of integer DEFAULT NULL,
ADD COLUMN send_all_instances boolean NOT NULL DEFAULT FALSE,
ADD COLUMN actor_type actor_type_enum NOT NULL DEFAULT 'person',
ADD COLUMN actor_apub_id text DEFAULT NULL;
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;
CREATE TABLE federation_queue_state (
id serial PRIMARY KEY,
instance_id integer NOT NULL UNIQUE REFERENCES instance (id),
last_successful_id bigint NOT NULL,
fail_count integer NOT NULL,
last_retry timestamptz NOT NULL
);
-- for incremental fetches of followers
CREATE INDEX idx_community_follower_published ON community_follower (published);