Update replaceable_schema.sql

This commit is contained in:
dullbananas 2023-12-22 23:48:38 -07:00 committed by GitHub
parent 5606a8c6cf
commit 3b4712d42f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,27 @@ CREATE TRIGGER aggregates
FOR EACH STATEMENT
EXECUTE FUNCTION r.community_aggregates_from_community ();
CREATE FUNCTION person_aggregates_from_person ()
RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
INSERT INTO person_aggregates (person_id)
SELECT
id,
FROM
new_person;
RETURN NULL;
END
$$;
CREATE TRIGGER aggregates
AFTER INSERT ON person
REFERENCING NEW TABLE AS new_person
FOR EACH STATEMENT
EXECUTE FUNCTION r.person_aggregates_from_person ();
CREATE FUNCTION r.post_aggregates_from_post ()
RETURNS trigger
LANGUAGE plpgsql