diff --git a/src/Model/Settings.hs b/src/Model/Settings.hs index d704a65..648b7e4 100644 --- a/src/Model/Settings.hs +++ b/src/Model/Settings.hs @@ -19,6 +19,8 @@ import Opaleye as O import Types import Classes +-- | This function does (as opposed to all other init functions) create just the table, +-- but also creates a first settings object with default values. initSettings :: PGS.Query initSettings = mconcat [ "CREATE TABLE IF NOT EXISTS \"settings\" (" @@ -42,8 +44,8 @@ settingsTable = table "settings" ( ) ) -getSettings :: PGS.Connection -> MateHandler Settings -getSettings conn = liftIO $ do +selectSettings :: PGS.Connection -> MateHandler Settings +selectSettings conn = liftIO $ do head . map fromDatabase <$> runSelect conn ( proc () -> do ret <- limit 1 $ selectTable settingsTable -< ()