Elixir Ecto,将更改类型更改为jsonb失败

时间:2019-03-13 12:17:35

标签: elixir phoenix-framework ecto

在将列类型修改为jsonb或map时出现错误。这是我的迁移文件:

  def change do
    alter table(:disbursements) do
      modify :reason, :map
    end
  end

我收到如下错误:

** (Postgrex.Error) ERROR 42804 (datatype_mismatch) column "reason" cannot be cast automatically to type jsonb

hint: You might need to specify "USING reason::jsonb".
(ecto_sql) lib/ecto/adapters/sql.ex:624: Ecto.Adapters.SQL.raise_sql_call_error/1

我的问题是如何向迁移文件中添加额外的命令USING reason::jsonb

0 个答案:

没有答案