Skip to content

Commit

Permalink
BIT(1) type cannot load as type :boolean elixir-ecto#1366
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgithub committed Apr 13, 2016
1 parent 09bd888 commit 95970c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ecto/adapters/mysql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ defmodule Ecto.Adapters.MySQL do
do: [&json_decode/1, &Ecto.Adapters.SQL.load_embed(type, &1)]
def loaders(_primitive, type), do: [type]

defp bool_decode(<<0>>), do: {:ok, false}
defp bool_decode(<<1>>), do: {:ok, true}
defp bool_decode(0), do: {:ok, false}
defp bool_decode(1), do: {:ok, true}
defp bool_decode(x), do: {:ok, x}
Expand Down

0 comments on commit 95970c2

Please sign in to comment.