From 66a5007a638f92fcd6d4cd7ef14288270e4dc4d8 Mon Sep 17 00:00:00 2001 From: paulgithub Date: Wed, 13 Apr 2016 10:05:36 +0100 Subject: [PATCH] BIT(1) type cannot load as type :boolean #1366 (#1369) --- lib/ecto/adapters/mysql.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ecto/adapters/mysql.ex b/lib/ecto/adapters/mysql.ex index 5a14e5ce02..be6132d186 100644 --- a/lib/ecto/adapters/mysql.ex +++ b/lib/ecto/adapters/mysql.ex @@ -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}