diff options
Diffstat (limited to 'priv')
| -rw-r--r-- | priv/repo/migrations/20200401030751_users_add_public_key.exs | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/priv/repo/migrations/20200401030751_users_add_public_key.exs b/priv/repo/migrations/20200401030751_users_add_public_key.exs new file mode 100644 index 000000000..04e5ad1e2 --- /dev/null +++ b/priv/repo/migrations/20200401030751_users_add_public_key.exs @@ -0,0 +1,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 | 
