8749c3e13df80e573dc8ea5c48eaefc59f5a1b9b
[anni] / priv / repo / migrations / 20211125110126_force_pinned_objects_to_exist.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do
6   use Ecto.Migration
7
8   def change do
9     execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL")
10
11     alter table("users") do
12       modify(:pinned_objects, :map, null: false, default: %{})
13     end
14   end
15 end