1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2025-02-03 13:01:34 +00:00
ibis/migrations/2025-01-17-150059_comments/down.sql
Nutomic 54c65e7474
Implement comments for articles (fixes #10) (#112)
* Move files into subfolders

* Implement comments for articles (fixes #10)

* wip

* backend mostly done

* tests wip

* test working

* wip federation

* partial federation

* comment federation working!

* federation and tests working with delete

* wip frontend

* basic comment rendering

* various

* wip comment tree rendering

* all working

* update rust

* comment markdown

* only one comment editor at a time

* display comment creation time

* fedilink

* live handling of delete/restore

* comment editing
2025-01-21 11:39:10 +00:00

36 lines
790 B
PL/PgSQL

DROP TRIGGER instance_stats_comment_insert ON comment;
DROP TRIGGER instance_stats_comment_delete ON comment;
DROP FUNCTION instance_stats_comment_insert;
DROP FUNCTION instance_stats_comment_delete;
ALTER TABLE instance_stats
DROP COLUMN comments;
DROP TABLE comment;
DROP FUNCTION generate_unique_comment_id;
CREATE OR REPLACE FUNCTION instance_stats_activity (i text)
RETURNS int
LANGUAGE plpgsql
AS $$
DECLARE
count_ integer;
BEGIN
SELECT
count(users) INTO count_
FROM ( SELECT DISTINCT
e.creator_id
FROM
edit e
INNER JOIN person p ON e.creator_id = p.id
WHERE
e.published > ('now'::timestamp - i::interval)
AND p.local = TRUE) AS users;
RETURN count_;
END;
$$;