mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 22:01:19 +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
|
UPDATE
|
||||||
thing_report
|
thing_report
|
||||||
SET
|
SET
|
||||||
resolved = TRUE, resolver_id = mod_person_id, updated = now()
|
resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_
|
||||||
FROM ( SELECT DISTINCT
|
FROM ( SELECT
|
||||||
thing_id
|
thing_id,
|
||||||
|
min(when_) AS when_
|
||||||
FROM new_removal
|
FROM new_removal
|
||||||
WHERE
|
WHERE
|
||||||
new_removal.removed) AS distinct_removal
|
new_removal.removed
|
||||||
|
GROUP BY
|
||||||
|
thing_id) AS first_removal
|
||||||
WHERE
|
WHERE
|
||||||
report.thing_id = distinct_removal.thing_id
|
report.thing_id = first_removal.thing_id
|
||||||
AND NOT report.resolved
|
AND NOT report.resolved
|
||||||
AND COALESCE(report.updated < now(), TRUE);
|
AND COALESCE(report.updated < first_removal.when_, TRUE);
|
||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
END $$;
|
END $$;
|
||||||
CREATE TRIGGER resolve_reports
|
CREATE TRIGGER resolve_reports
|
||||||
|
|
Loading…
Reference in a new issue