DB prune: Check if user follows hashtag with no objects before deletion
This commit is contained in:
parent
1c685ea41a
commit
e32ab8aef2
2 changed files with 7 additions and 1 deletions
1
changelog.d/prune-hashtag-follow-3376.fix
Normal file
1
changelog.d/prune-hashtag-follow-3376.fix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
DB prune: Check if user follows hashtag with no objects before deletion
|
||||||
|
|
@ -226,7 +226,12 @@ defmodule Mix.Tasks.Pleroma.Database do
|
||||||
DELETE FROM hashtags AS ht
|
DELETE FROM hashtags AS ht
|
||||||
WHERE NOT EXISTS (
|
WHERE NOT EXISTS (
|
||||||
SELECT 1 FROM hashtags_objects hto
|
SELECT 1 FROM hashtags_objects hto
|
||||||
WHERE ht.id = hto.hashtag_id)
|
WHERE ht.id = hto.hashtag_id
|
||||||
|
)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM user_follows_hashtag ufh
|
||||||
|
WHERE ht.id = ufh.hashtag_id
|
||||||
|
)
|
||||||
"""
|
"""
|
||||||
|> Repo.query()
|
|> Repo.query()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue