migration and changelog
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Mon, 7 Sep 2020 08:54:10 +0000 (11:54 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Thu, 10 Sep 2020 13:01:20 +0000 (16:01 +0300)
CHANGELOG.md
priv/repo/migrations/20200907084956_remove_cron_clear_oauth_token_worker_from_oban_config.exs [new file with mode: 0644]

index 19b2596cc32aa640263a8fe9cef104585f2714ac..14c0252f73bf7d393af95aea3284107ea977bc39 100644 (file)
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 ### Removed
 
 - **Breaking:** Removed `Pleroma.Workers.Cron.StatsWorker` setting from Oban `:crontab`.
+- **Breaking:** Removed `Pleroma.Workers.Cron.ClearOauthTokenWorker` setting from Oban `:crontab` config.
 
 ## [2.1.1] - 2020-09-08
 
diff --git a/priv/repo/migrations/20200907084956_remove_cron_clear_oauth_token_worker_from_oban_config.exs b/priv/repo/migrations/20200907084956_remove_cron_clear_oauth_token_worker_from_oban_config.exs
new file mode 100644 (file)
index 0000000..d9c9725
--- /dev/null
@@ -0,0 +1,20 @@
+defmodule Pleroma.Repo.Migrations.RemoveCronClearOauthTokenWorkerFromObanConfig do
+  use Ecto.Migration
+
+  def change do
+     with %Pleroma.ConfigDB{} = config <-
+           Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Oban}),
+         crontab when is_list(crontab) <- config.value[:crontab],
+         index when is_integer(index) <-
+           Enum.find_index(crontab, fn {_, worker} ->
+             worker == Pleroma.Workers.Cron.ClearOauthTokenWorker
+           end) do
+      updated_value = Keyword.put(config.value, :crontab, List.delete_at(crontab, index))
+
+      config
+      |> Ecto.Changeset.change(value: updated_value)
+      |> Pleroma.Repo.update()
+    end
+
+  end
+end