summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200401072456_users_add_inboxes.exs
blob: 0947f0ab25ac67b479b0f0e3bf3a4c0e47287d76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
defmodule Pleroma.Repo.Migrations.UsersAddInboxes do
  use Ecto.Migration

  def up do
    alter table(:users) do
      add_if_not_exists(:inbox, :text)
      add_if_not_exists(:shared_inbox, :text)
    end

    execute("UPDATE users SET inbox = source_data->>'inbox'")
    execute("UPDATE users SET shared_inbox = source_data->'endpoints'->>'sharedInbox'")
  end

  def down do
    alter table(:users) do
      remove_if_exists(:inbox, :text)
      remove_if_exists(:shared_inbox, :text)
    end
  end
end