mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-28 05:41:34 +00:00
Update replaceable_schema.sql
This commit is contained in:
parent
b97a039c45
commit
0a93d1979c
1 changed files with 9 additions and 6 deletions
|
@ -86,16 +86,19 @@ BEGIN
|
|||
UPDATE
|
||||
thing_report
|
||||
SET
|
||||
resolved = TRUE, resolver_id = mod_person_id, updated = now()
|
||||
FROM ( SELECT DISTINCT
|
||||
thing_id
|
||||
resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_
|
||||
FROM ( SELECT
|
||||
thing_id,
|
||||
min(when_) AS when_
|
||||
FROM new_removal
|
||||
WHERE
|
||||
new_removal.removed) AS distinct_removal
|
||||
new_removal.removed
|
||||
GROUP BY
|
||||
thing_id) AS first_removal
|
||||
WHERE
|
||||
report.thing_id = distinct_removal.thing_id
|
||||
report.thing_id = first_removal.thing_id
|
||||
AND NOT report.resolved
|
||||
AND COALESCE(report.updated < now(), TRUE);
|
||||
AND COALESCE(report.updated < first_removal.when_, TRUE);
|
||||
RETURN NULL;
|
||||
END $$;
|
||||
CREATE TRIGGER resolve_reports
|
||||
|
|
Loading…
Reference in a new issue