Fix a migration wiping user info of users that don't have any mutes
And introduce safe_jsonb_set
This commit is contained in:
parent
724f611b0e
commit
39e996528c
5 changed files with 30 additions and 8 deletions
|
|
@ -181,7 +181,7 @@ defmodule Pleroma.Object do
|
|||
data:
|
||||
fragment(
|
||||
"""
|
||||
jsonb_set(?, '{repliesCount}',
|
||||
safe_jsonb_set(?, '{repliesCount}',
|
||||
(coalesce((?->>'repliesCount')::int, 0) + 1)::varchar::jsonb, true)
|
||||
""",
|
||||
o.data,
|
||||
|
|
@ -204,7 +204,7 @@ defmodule Pleroma.Object do
|
|||
data:
|
||||
fragment(
|
||||
"""
|
||||
jsonb_set(?, '{repliesCount}',
|
||||
safe_jsonb_set(?, '{repliesCount}',
|
||||
(greatest(0, (?->>'repliesCount')::int - 1))::varchar::jsonb, true)
|
||||
""",
|
||||
o.data,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue