aboutsummaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20220807125023_data_migration_delete_context_objects.exs13
1 files changed, 8 insertions, 5 deletions
diff --git a/priv/repo/migrations/20220807125023_data_migration_delete_context_objects.exs b/priv/repo/migrations/20220807125023_data_migration_delete_context_objects.exs
index debb474b2..84365dbe3 100644
--- a/priv/repo/migrations/20220807125023_data_migration_delete_context_objects.exs
+++ b/priv/repo/migrations/20220807125023_data_migration_delete_context_objects.exs
@@ -3,13 +3,16 @@ defmodule Pleroma.Repo.Migrations.DataMigrationDeleteContextObjects do
require Logger
- @doc "This migration removes objects created exclusively for contexts, containing only an `id` field."
+ def up do
+ dt = NaiveDateTime.utc_now()
- def change do
- Logger.warn(
- "This migration can take a very long time to execute, depending on your database size. Please be patient, Pleroma-tan is doing her best!\n"
+ execute(
+ "INSERT INTO data_migrations(name, inserted_at, updated_at) " <>
+ "VALUES ('delete_context_objects', '#{dt}', '#{dt}') ON CONFLICT DO NOTHING;"
)
+ end
- execute("DELETE FROM objects WHERE (data->>'type') IS NULL;")
+ def down do
+ execute("DELETE FROM data_migrations WHERE name = 'delete_context_objects';")
end
end