From 9fd39458eb6fe8fe215ca4b9d30cfb91c791d92e Mon Sep 17 00:00:00 2001 From: Your New SJW Waifu Date: Fri, 5 Feb 2021 08:48:07 -0600 Subject: [PATCH] fix users --- fix_users.ex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 fix_users.ex diff --git a/fix_users.ex b/fix_users.ex new file mode 100644 index 000000000..11071a1f4 --- /dev/null +++ b/fix_users.ex @@ -0,0 +1,21 @@ +alias Pleroma.{User,Repo} + +import Ecto.Query +import Ecto.Changeset + +from( + u in User, + where: fragment("? ->> 'id' IS NULL", u.info), + update: [ + set: [info: nil] + ] +) |> Repo.update_all([]) + +User +|> where([user], fragment("? ->> 'id' IS NULL", user.info)) +|> Repo.all() +|> Enum.each(fn user -> + change(user) + |> put_embed(:info, %User.Info{locked: true, hide_followers: true, hide_follows: true}) + |> User.update_and_set_cache() +end)