From 182c563ed0d461e7925a2556acaecb9a717f07ce Mon Sep 17 00:00:00 2001 From: NEETzsche Date: Mon, 29 Nov 2021 18:08:09 +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 000000000..1fe9271f0 --- /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 -- 2.45.2