summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20221103014611_create_oban_peers.exs7
-rw-r--r--priv/repo/migrations/20221103014728_swap_primary_oban_indexes.exs26
-rw-r--r--priv/repo/migrations/20221111164213_deprecate_quack.exs24
3 files changed, 57 insertions, 0 deletions
diff --git a/priv/repo/migrations/20221103014611_create_oban_peers.exs b/priv/repo/migrations/20221103014611_create_oban_peers.exs
new file mode 100644
index 000000000..cb522a056
--- /dev/null
+++ b/priv/repo/migrations/20221103014611_create_oban_peers.exs
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.CreateObanPeers do
+ use Ecto.Migration
+
+ def up, do: Oban.Migrations.up(version: 11)
+
+ def down, do: Oban.Migrations.down(version: 11)
+end
diff --git a/priv/repo/migrations/20221103014728_swap_primary_oban_indexes.exs b/priv/repo/migrations/20221103014728_swap_primary_oban_indexes.exs
new file mode 100644
index 000000000..54e2503de
--- /dev/null
+++ b/priv/repo/migrations/20221103014728_swap_primary_oban_indexes.exs
@@ -0,0 +1,26 @@
+defmodule Pleroma.Repo.Migrations.SwapPrimaryObanIndexes do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+ @disable_migration_lock true
+
+ def change do
+ create_if_not_exists(
+ index(
+ :oban_jobs,
+ [:state, :queue, :priority, :scheduled_at, :id],
+ concurrently: true,
+ prefix: "public"
+ )
+ )
+
+ drop_if_exists(
+ index(
+ :oban_jobs,
+ [:queue, :state, :priority, :scheduled_at, :id],
+ concurrently: true,
+ prefix: "public"
+ )
+ )
+ end
+end
diff --git a/priv/repo/migrations/20221111164213_deprecate_quack.exs b/priv/repo/migrations/20221111164213_deprecate_quack.exs
new file mode 100644
index 000000000..d30fe8117
--- /dev/null
+++ b/priv/repo/migrations/20221111164213_deprecate_quack.exs
@@ -0,0 +1,24 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.DeprecateQuack do
+ use Ecto.Migration
+ alias Pleroma.ConfigDB
+
+ def up do
+ :quack
+ |> ConfigDB.get_all_by_group()
+ |> Enum.each(&ConfigDB.delete/1)
+
+ logger_config = ConfigDB.get_by_group_and_key(:logger, :backends)
+
+ if not is_nil(logger_config) do
+ %{value: backends} = logger_config
+ new_backends = backends -- [Quack.Logger]
+ {:ok, _} = ConfigDB.update_or_create(%{group: :logger, key: :backends, value: new_backends})
+ end
+ end
+
+ def down, do: :ok
+end