From f0718ce228cb015daeea848d98e8a757e66fd7d9 Mon Sep 17 00:00:00 2001 From: Steve Mao Date: Mon, 8 Apr 2024 21:35:29 +1000 Subject: [PATCH] IsSqlType instance is needed if the field is an array of enum when toFields is used on sql array, it uses this instance ``` (Default ToFields a (Field_ n b), IsSqlType b) => Default ToFields [a] (Field (SqlArray_ n b)) ``` Which cast the value to the enum type --- src/Opaleye/Experimental/Enum.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Opaleye/Experimental/Enum.hs b/src/Opaleye/Experimental/Enum.hs index 83eeeb3f..5fb89bc3 100644 --- a/src/Opaleye/Experimental/Enum.hs +++ b/src/Opaleye/Experimental/Enum.hs @@ -83,6 +83,9 @@ data EnumMapper sqlEnum haskellSum = EnumMapper { -- -- instance D.Default O.ToFields Rating (O.Field SqlRating) where -- def = enumToFields sqlRatingMapper +-- +-- instance IsSqlType SqlRating where +-- showSqlType _ = "mpaa_rating" -- @ enumMapper :: String -- ^ The name of the @ENUM@ type