Migrations: Add migration to fill empty info fields and make them non-null.

This commit is contained in:
lain 2019-11-01 13:31:55 +01:00
parent a43b899e94
commit 8ad75f9ecf

View File

@ -0,0 +1,17 @@
defmodule Pleroma.Repo.Migrations.FixAndSecureUserInfoField do
use Ecto.Migration
def up do
execute("UPDATE users SET info = '{}'::jsonb WHERE info IS NULL")
execute("ALTER TABLE users
ALTER COLUMN info SET NOT NULL
")
end
def down do
execute("ALTER TABLE users
ALTER COLUMN info DROP NOT NULL
")
end
end