summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-11-17 15:01:38 +0100
committerlain <lain@soykaf.club>2020-11-17 15:01:38 +0100
commitfec1ed802ef44a700df27aa132146f79e9e4cd6d (patch)
tree6bbb39b647305521209bebbd7bdea3e4be012d1c /priv/repo/migrations
parent81293e5aadd5f1dfe7f90f6a71f625ef86cf3359 (diff)
parent9b9afe6b3fde77ef005629fe2d198160c8f465a1 (diff)
downloadpleroma-fec1ed802ef44a700df27aa132146f79e9e4cd6d.tar.gz
pleroma-fec1ed802ef44a700df27aa132146f79e9e4cd6d.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/local-only-scope
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs48
-rw-r--r--priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs19
2 files changed, 67 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs b/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs
new file mode 100644
index 000000000..01fb90459
--- /dev/null
+++ b/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs
@@ -0,0 +1,48 @@
+defmodule Pleroma.Repo.Migrations.AddPleromaReportTypeToEnumForNotifications do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+
+ def up do
+ """
+ alter type notification_type add value 'pleroma:report'
+ """
+ |> execute()
+ end
+
+ def down do
+ alter table(:notifications) do
+ modify(:type, :string)
+ end
+
+ """
+ delete from notifications where type = 'pleroma:report'
+ """
+ |> execute()
+
+ """
+ drop type if exists notification_type
+ """
+ |> execute()
+
+ """
+ create type notification_type as enum (
+ 'follow',
+ 'follow_request',
+ 'mention',
+ 'move',
+ 'pleroma:emoji_reaction',
+ 'pleroma:chat_mention',
+ 'reblog',
+ 'favourite'
+ )
+ """
+ |> execute()
+
+ """
+ alter table notifications
+ alter column type type notification_type using (type::notification_type)
+ """
+ |> execute()
+ end
+end
diff --git a/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs b/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs
new file mode 100644
index 000000000..fe31f4442
--- /dev/null
+++ b/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.RemovePurgeExpiredActivityWorkerFromObanConfig 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.PurgeExpiredActivitiesWorker
+ 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