mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 03:11:32 +00:00
Merge remote-tracking branch 'origin/main' into combined_profile
This commit is contained in:
commit
a1792bb16e
1 changed files with 32 additions and 0 deletions
|
@ -761,3 +761,35 @@ CALL r.create_person_saved_combined_trigger ('post');
|
||||||
|
|
||||||
CALL r.create_person_saved_combined_trigger ('comment');
|
CALL r.create_person_saved_combined_trigger ('comment');
|
||||||
|
|
||||||
|
-- Combined tables triggers
|
||||||
|
-- These insert (published, item_id) into X_combined tables
|
||||||
|
-- Reports (comment_report, post_report, private_message_report)
|
||||||
|
CREATE PROCEDURE r.create_report_combined_trigger (table_name text)
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $a$
|
||||||
|
BEGIN
|
||||||
|
EXECUTE replace($b$ CREATE FUNCTION r.report_combined_thing_insert ( )
|
||||||
|
RETURNS TRIGGER
|
||||||
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO report_combined (published, thing_id)
|
||||||
|
VALUES (NEW.published, NEW.id);
|
||||||
|
RETURN NEW;
|
||||||
|
END $$;
|
||||||
|
CREATE TRIGGER report_combined
|
||||||
|
AFTER INSERT ON thing
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION r.report_combined_thing_insert ( );
|
||||||
|
$b$,
|
||||||
|
'thing',
|
||||||
|
table_name);
|
||||||
|
END;
|
||||||
|
$a$;
|
||||||
|
|
||||||
|
CALL r.create_report_combined_trigger ('post_report');
|
||||||
|
|
||||||
|
CALL r.create_report_combined_trigger ('comment_report');
|
||||||
|
|
||||||
|
CALL r.create_report_combined_trigger ('private_message_report');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue