diff --git a/priv/repo/migrations/20190711042020_fix_and_secure_user_info_field.exs b/priv/repo/migrations/20190711042020_fix_and_secure_user_info_field.exs new file mode 100644 index 000000000..9602a8c41 --- /dev/null +++ b/priv/repo/migrations/20190711042020_fix_and_secure_user_info_field.exs @@ -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