summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200401030751_users_add_public_key.exs
blob: 04e5ad1e2d7f3fcaacdca6b437073367feb8680d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
defmodule Pleroma.Repo.Migrations.UsersAddPublicKey do
  use Ecto.Migration

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

    execute("UPDATE users SET public_key = source_data->'publicKey'->>'publicKeyPem'")
  end

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