First
[anni] / priv / repo / migrations / 20200905082737_rename_await_up_timeout_in_connections_pool.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.RenameAwaitUpTimeoutInConnectionsPool do
6   use Ecto.Migration
7
8   def change do
9     with %Pleroma.ConfigDB{} = config <-
10            Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: :connections_pool}),
11          {timeout, value} when is_integer(timeout) <- Keyword.pop(config.value, :await_up_timeout) do
12       config
13       |> Ecto.Changeset.change(value: Keyword.put(value, :connect_timeout, timeout))
14       |> Pleroma.Repo.update()
15     end
16   end
17 end