forked from mirrors/akkoma
mix prune_objects: remove unused hashtags after pruning remote objects
This commit is contained in:
parent
22b2451edd
commit
a0c9a2b4cc
|
@ -96,6 +96,17 @@ def run(["prune_objects" | args]) do
|
||||||
)
|
)
|
||||||
|> Repo.delete_all(timeout: :infinity)
|
|> Repo.delete_all(timeout: :infinity)
|
||||||
|
|
||||||
|
prune_hashtags_query = """
|
||||||
|
delete from hashtags
|
||||||
|
where id in (
|
||||||
|
select id from hashtags as ht
|
||||||
|
left join hashtags_objects as hto
|
||||||
|
on hto.hashtag_id = ht.id
|
||||||
|
where hto.hashtag_id is null)
|
||||||
|
"""
|
||||||
|
|
||||||
|
Repo.query(prune_hashtags_query)
|
||||||
|
|
||||||
if Keyword.get(options, :vacuum) do
|
if Keyword.get(options, :vacuum) do
|
||||||
Maintenance.vacuum("full")
|
Maintenance.vacuum("full")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue