mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2025-01-25 07:05:09 +00:00
Update hashtag prune to account for followed hashtags
Currently pruning hashtags with the prune_objects task only accounts for whether that hashtag is associated with an object, but this may lead to a foreign key constraint violation if that hashtag has no objects but is followed by a local user. This adds an additional check to see if that hashtag has any followers before proceeding to delete it.
This commit is contained in:
parent
f101886709
commit
40da4e88ea
1 changed files with 4 additions and 1 deletions
|
@ -346,7 +346,10 @@ defmodule Mix.Tasks.Pleroma.Database do
|
|||
DELETE FROM hashtags AS ht
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM hashtags_objects hto
|
||||
WHERE ht.id = hto.hashtag_id)
|
||||
WHERE ht.id = hto.hashtag_id
|
||||
UNION
|
||||
SELECT 1 FROM user_follows_hashtag ufht
|
||||
WHERE ht.id = ufht.hashtag_id)
|
||||
"""
|
||||
|> Repo.query!()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue