User: Move public_key from source_data to own field

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-04-01 06:58:48 +02:00
commit 19eedb3d04
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
4 changed files with 30 additions and 13 deletions

View file

@ -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