User: Move public_key from source_data to own field
This commit is contained in:
parent
5628984df4
commit
19eedb3d04
4 changed files with 30 additions and 13 deletions
17
priv/repo/migrations/20200401030751_users_add_public_key.exs
Normal file
17
priv/repo/migrations/20200401030751_users_add_public_key.exs
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue