fbba31c83982ca4c5d78f3ed07771740d8c526b6
[anni] / priv / repo / migrations / 20190203185340_split_hide_network.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.SplitHideNetwork do
6   use Ecto.Migration
7
8   def up do
9     execute(
10       "UPDATE users SET info = jsonb_set(info, '{hide_network}'::text[], 'false'::jsonb) WHERE NOT(info::jsonb ? 'hide_network') AND local"
11     )
12
13     execute(
14       "UPDATE users SET info = jsonb_set(info, '{hide_followings}'::text[], info->'hide_network') WHERE local"
15     )
16
17     execute(
18       "UPDATE users SET info = jsonb_set(info, '{hide_followers}'::text[], info->'hide_network') WHERE local"
19     )
20   end
21
22   def down do
23   end
24 end