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

stable
lain 5 years ago
parent a43b899e94
commit 8ad75f9ecf

@ -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
Loading…
Cancel
Save