mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-03 23:00:24 +01:00
Compatibility with newer persistent
This commit is contained in:
parent
af987be2ab
commit
25e12579dd
@ -1,4 +1,5 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE DerivingStrategies #-}
|
{-# LANGUAGE DerivingStrategies #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
@ -46,7 +47,12 @@ module Stackage.Database.Schema
|
|||||||
, module PS
|
, module PS
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Logger (runNoLoggingT, runStdoutLoggingT, MonadLogger)
|
import Control.Monad.Logger (runNoLoggingT, runStdoutLoggingT)
|
||||||
|
#if MIN_VERSION_monad_logger(0,3,10) && MIN_VERSION_persistent_postgresql(2,12,0)
|
||||||
|
import Control.Monad.Logger (MonadLoggerIO)
|
||||||
|
#else
|
||||||
|
import Control.Monad.Logger (MonadLogger)
|
||||||
|
#endif
|
||||||
import qualified Data.Aeson as A
|
import qualified Data.Aeson as A
|
||||||
import Data.Pool (destroyAllResources, Pool)
|
import Data.Pool (destroyAllResources, Pool)
|
||||||
import Database.Persist
|
import Database.Persist
|
||||||
@ -186,7 +192,12 @@ run inner = do
|
|||||||
|
|
||||||
withStackageDatabase :: MonadUnliftIO m => Bool -> DatabaseSettings -> (StackageDatabase -> m a) -> m a
|
withStackageDatabase :: MonadUnliftIO m => Bool -> DatabaseSettings -> (StackageDatabase -> m a) -> m a
|
||||||
withStackageDatabase shouldLog dbs inner = do
|
withStackageDatabase shouldLog dbs inner = do
|
||||||
let makePool :: (MonadUnliftIO m, MonadLogger m) => m (Pool SqlBackend)
|
let
|
||||||
|
#if MIN_VERSION_monad_logger(0,3,10) && MIN_VERSION_persistent_postgresql(2,12,0)
|
||||||
|
makePool :: (MonadUnliftIO m, MonadLoggerIO m) => m (Pool SqlBackend)
|
||||||
|
#else
|
||||||
|
makePool :: (MonadUnliftIO m, MonadLogger m) => m (Pool SqlBackend)
|
||||||
|
#endif
|
||||||
makePool =
|
makePool =
|
||||||
case dbs of
|
case dbs of
|
||||||
DSPostgres connStr mSize -> do
|
DSPostgres connStr mSize -> do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user