mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 13:51:19 +00:00
Update replaceable_schema.sql
This commit is contained in:
parent
5606a8c6cf
commit
3b4712d42f
1 changed files with 21 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue