From c1c8e380959d5f3a42f25804c84944d942c872b0 Mon Sep 17 00:00:00 2001 From: paulgithub Date: Wed, 13 Apr 2016 10:05:03 +0100 Subject: [PATCH] BIT(1) type cannot load as type :boolean #1366 (#1368) --- 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 73cd825f21..0c03e627dd 100644 --- a/lib/ecto/adapters/mysql.ex +++ b/lib/ecto/adapters/mysql.ex @@ -93,6 +93,8 @@ defmodule Ecto.Adapters.MySQL do do: super(type, json_library.decode!(binary)) def load(:map, binary) when is_binary(binary), do: super(:map, json_library.decode!(binary)) + def load(:boolean, <<0>>), do: {:ok, false} + def load(:boolean, <<1>>), do: {:ok, true} def load(:boolean, 0), do: {:ok, false} def load(:boolean, 1), do: {:ok, true} def load(type, value), do: super(type, value)