Removes toBool function as we now cast the 'YES/NO' values to boolean in PostgreSQL's queries

This commit is contained in:
Diogo Biazus
2015-06-22 18:09:45 -04:00
parent 1937363fc8
commit e87be593c0
+5 -8
View File
@@ -58,8 +58,8 @@ columns table = do
cols <- H.listEx $ [H.stmt| cols <- H.listEx $ [H.stmt|
select info.table_schema as schema, info.table_name as table_name, select info.table_schema as schema, info.table_name as table_name,
info.column_name as name, info.ordinal_position as position, info.column_name as name, info.ordinal_position as position,
info.is_nullable as nullable, info.data_type as col_type, info.is_nullable::boolean as nullable, info.data_type as col_type,
info.is_updatable as updatable, info.is_updatable::boolean as updatable,
info.character_maximum_length as max_len, info.character_maximum_length as max_len,
info.numeric_precision as precision, info.numeric_precision as precision,
info.column_default as default_value, info.column_default as default_value,
@@ -108,9 +108,6 @@ primaryKeyColumns table = do
return $ map runIdentity r return $ map runIdentity r
toBool :: Text -> Bool
toBool = (== "YES")
data Table = Table { data Table = Table {
tableSchema :: Text tableSchema :: Text
, tableName :: Text , tableName :: Text
@@ -140,12 +137,12 @@ tableFromRow :: (Text, Text, Bool) -> Table
tableFromRow (s, n, i) = Table s n i tableFromRow (s, n, i) = Table s n i
columnFromRow :: (Text, Text, Text, columnFromRow :: (Text, Text, Text,
Int, Text, Text, Int, Bool, Text,
Text, Maybe Int, Maybe Int, Bool, Maybe Int, Maybe Int,
Maybe Text, Maybe Text) Maybe Text, Maybe Text)
-> Column -> Column
columnFromRow (s, t, n, pos, nul, typ, u, l, p, d, e) = columnFromRow (s, t, n, pos, nul, typ, u, l, p, d, e) =
Column s t n pos (toBool nul) typ (toBool u) l p d (parseEnum e) Nothing Column s t n pos nul typ u l p d (parseEnum e) Nothing
where where
parseEnum :: Maybe Text -> [Text] parseEnum :: Maybe Text -> [Text]