From 929e60122fd7d7c83d8567d2f46f555dc278a0c1 Mon Sep 17 00:00:00 2001 From: NEETzsche <8018262-NEETzsche@users.noreply.gitlab.com> Date: Thu, 25 Nov 2021 16:34:48 +0000 Subject: [PATCH] Force pinned_objects to be empty, not null --- .../20211125110126_force_pinned_objects_to_exist.exs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs diff --git a/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs new file mode 100644 index 0000000000..1fe9271f02 --- /dev/null +++ b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do + use Ecto.Migration + + def change do + execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL") + + alter table("users") do + modify(:pinned_objects, :map, null: false, default: %{}) + end + end +end