1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.GenerateUnsetUserKeys do
15 where: u.local == true,
16 where: is_nil(u.keys),
21 |> Enum.each(fn user ->
22 with {:ok, pem} <- Keys.generate_rsa_pem() do
23 Ecto.Changeset.cast(%User{id: user}, %{keys: pem}, [:keys])
24 |> Repo.update(returning: false)