Page MenuHomePhorge

No OneTemporary

Size
6 KB
Referenced Files
None
Subscribers
None
diff --git a/changelog.d/rebased-migration.change b/changelog.d/rebased-migration.change
new file mode 100644
index 000000000..53ae0951a
--- /dev/null
+++ b/changelog.d/rebased-migration.change
@@ -0,0 +1 @@
+Add optional migrations for rollback from Rebased
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20210612185407_add_email_list_field_to_users.exs b/priv/repo/optional_migrations/rebased_rollbacks/20210612185407_add_email_list_field_to_users.exs
new file mode 100644
index 000000000..7dd37a6db
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20210612185407_add_email_list_field_to_users.exs
@@ -0,0 +1,14 @@
+# Adapted from Rebased
+# https://gitlab.com/soapbox-pub/rebased/-/blob/main/priv/repo/migrations/20210612185407_add_email_list_field_to_users.exs
+
+defmodule Pleroma.Repo.Migrations.AddEmailListFieldToUsers do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ alter table(:users) do
+ remove_if_exists(:accepts_email_list, :boolean)
+ end
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20220225164000_add_activity_assigned_account_index.exs b/priv/repo/optional_migrations/rebased_rollbacks/20220225164000_add_activity_assigned_account_index.exs
new file mode 100644
index 000000000..fd2193a12
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20220225164000_add_activity_assigned_account_index.exs
@@ -0,0 +1,13 @@
+defmodule Pleroma.Repo.Migrations.AddActivityAssignedAccountIndex do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ drop_if_exists(
+ index(:activities, ["(data->>'assigned_account')"],
+ name: :activities_assigned_account_index
+ )
+ )
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20220314220000_add_location_to_users.exs b/priv/repo/optional_migrations/rebased_rollbacks/20220314220000_add_location_to_users.exs
new file mode 100644
index 000000000..d2d317d63
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20220314220000_add_location_to_users.exs
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.AddLocationToUsers do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ alter table(:users) do
+ remove_if_exists(:location, :string)
+ end
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20220624104914_create_webhooks.exs b/priv/repo/optional_migrations/rebased_rollbacks/20220624104914_create_webhooks.exs
new file mode 100644
index 000000000..421dc0107
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20220624104914_create_webhooks.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.CreateWebhooks do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ drop_if_exists(unique_index(:webhooks, [:url]))
+ drop_if_exists(table(:webhooks))
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20220819171321_add_pleroma_participation_accepted_to_notifications_enum.exs b/priv/repo/optional_migrations/rebased_rollbacks/20220819171321_add_pleroma_participation_accepted_to_notifications_enum.exs
new file mode 100644
index 000000000..68d242309
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20220819171321_add_pleroma_participation_accepted_to_notifications_enum.exs
@@ -0,0 +1,45 @@
+defmodule Pleroma.Repo.Migrations.AddPleromaParticipationAcceptedToNotificationsEnum do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ alter table(:notifications) do
+ modify(:type, :string)
+ end
+
+ """
+ delete from notifications where type in ('pleroma:participation_accepted', 'pleroma:participation_request', 'pleroma:event_reminder', 'pleroma:event_update')
+ """
+ |> 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',
+ 'pleroma:report',
+ 'poll',
+ 'status',
+ 'update'
+ )
+ """
+ |> execute()
+
+ """
+ alter table notifications
+ alter column type type notification_type using (type::notification_type)
+ """
+ |> execute()
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20220927220033_add_last_move_at_to_users.exs b/priv/repo/optional_migrations/rebased_rollbacks/20220927220033_add_last_move_at_to_users.exs
new file mode 100644
index 000000000..3414d5fb5
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20220927220033_add_last_move_at_to_users.exs
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.AddLastMoveAtToUsers do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ alter table(:users) do
+ remove_if_exists(:last_move_at, :naive_datetime)
+ end
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20221029171353_add_internal_to_webhooks.exs b/priv/repo/optional_migrations/rebased_rollbacks/20221029171353_add_internal_to_webhooks.exs
new file mode 100644
index 000000000..fc85eebb9
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20221029171353_add_internal_to_webhooks.exs
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.AddInternalToWebhooks do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ alter table(:webhooks) do
+ remove_if_exists(:internal, :boolean)
+ end
+ end
+end
diff --git a/priv/repo/optional_migrations/rebased_rollbacks/20221207235104_add_events_index.exs b/priv/repo/optional_migrations/rebased_rollbacks/20221207235104_add_events_index.exs
new file mode 100644
index 000000000..4e2709277
--- /dev/null
+++ b/priv/repo/optional_migrations/rebased_rollbacks/20221207235104_add_events_index.exs
@@ -0,0 +1,17 @@
+# Adapted from Rebased
+# https://gitlab.com/soapbox-pub/rebased/-/blob/main/priv/repo/migrations/20221207235104_add_events_index.exs
+
+defmodule Pleroma.Repo.Migrations.AddEventsIndex do
+ use Ecto.Migration
+
+ def up, do: :noop
+
+ def down do
+ drop_if_exists(
+ index(:objects, ["(data->>'type')"],
+ where: "data->>'type' = 'Event'",
+ name: :objects_events
+ )
+ )
+ end
+end

File Metadata

Mime Type
text/x-diff
Expires
Mon, Oct 12, 12:34 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1786186
Default Alt Text
(6 KB)

Event Timeline