Merge branch 'remake-remodel-dms' into 'develop'
[akkoma] / priv / repo / migrations / 20200401072456_users_add_inboxes.exs
1 defmodule Pleroma.Repo.Migrations.UsersAddInboxes do
2 use Ecto.Migration
3
4 def up do
5 alter table(:users) do
6 add_if_not_exists(:inbox, :text)
7 add_if_not_exists(:shared_inbox, :text)
8 end
9
10 execute("UPDATE users SET inbox = source_data->>'inbox'")
11 execute("UPDATE users SET shared_inbox = source_data->'endpoints'->>'sharedInbox'")
12 end
13
14 def down do
15 alter table(:users) do
16 remove_if_exists(:inbox, :text)
17 remove_if_exists(:shared_inbox, :text)
18 end
19 end
20 end