To perform the migration, you can do the following. The payload in this case was originally a json field.
class AlterJsonbToJsonAndBack < ActiveRecord::Migration
def up
change_column :dynamics, :payload, 'jsonb USING CAST(payload AS jsonb)'
end
def down
change_column :dynamics, :payload, 'json USING CAST(payload AS json)'
end
end
To learn how to request jsonb in Rails 4.2, check out this article.
source
share