mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-29 14:45:51 +03:00
Add no primary key warning message.
This commit is contained in:
parent
692bb7ea70
commit
dc7beb9803
@ -107,6 +107,9 @@ defineTableFromDB connect drv scm tbl derives = do
|
|||||||
return (cols, notNullIdxs, primCols) )
|
return (cols, notNullIdxs, primCols) )
|
||||||
|
|
||||||
(cols, notNullIdxs, primaryCols) <- runIO getDBinfo
|
(cols, notNullIdxs, primaryCols) <- runIO getDBinfo
|
||||||
|
when (null primaryCols) . reportWarning
|
||||||
|
$ "getPrimaryKey: Primary key not found for table: " ++ scm ++ "." ++ tbl
|
||||||
|
|
||||||
let colIxMap = Map.fromList $ zip [c | (c, _) <- cols] [(0 :: Int) .. ]
|
let colIxMap = Map.fromList $ zip [c | (c, _) <- cols] [(0 :: Int) .. ]
|
||||||
lookup' k = do
|
lookup' k = do
|
||||||
let found = Map.lookup k colIxMap
|
let found = Map.lookup k colIxMap
|
||||||
|
Loading…
Reference in New Issue
Block a user