我已经搜索了这个问题的明确答案,但还没有找到 - 如何启用持久执行的 SQL 语句的自动日志记录?有人可以给我一个小示例程序吗?
以下是当前没有日志记录的示例程序。如何启用登录?
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Person
name Text
status Text Maybe
deriving Show
|]
main :: IO ()
main = runSqlite ":memory:" $ do
runMigration migrateAll
insert (Person "Oliver Charles" Nothing)
insert (Person "Jon Snow" Nothing)
insert (Person "Marky Mark" (Just "helloo helloo"))
noStatusPeople >>= mapM_ (liftIO . print)
where
noStatusPeople =
select $ from $ \person -> do
where_ (person ^. PersonStatus ==. val Nothing)
return (person ^. PersonName)