mirror of
https://gitlab.com/commento/commento.git
synced 2026-11-01 01:16:21 -05:00
api,db: add comments count endpoint
Closes https://gitlab.com/commento/commento-ce/issues/27
This commit is contained in:
1 parent
299649cea2
commit
330131f390
6 files changed
+118
-2
No files matched your search
@@ -0,0 +1,15 @@
|
||||
ALTER TABLE pages
|
||||
ADD commentCount INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
CREATE OR REPLACE FUNCTION commentsInsertTriggerFunction() RETURNS TRIGGER AS $trigger$
|
||||
BEGIN
|
||||
UPDATE pages
|
||||
SET commentCount = commentCount + 1
|
||||
WHERE domain = new.domain AND path = new.path;
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$trigger$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER commentsInsertTrigger AFTER INSERT ON comments
|
||||
FOR EACH ROW EXECUTE PROCEDURE commentsInsertTriggerFunction();
|
||||
Reference in new issue
Block a user