transplant to postgresql

This commit is contained in:
nek0 2015-04-06 23:12:58 +02:00
parent d5c502b760
commit 684d8167ad
4 changed files with 14 additions and 14 deletions

View file

@ -7,8 +7,8 @@ module Application
) where
import Control.Monad.Logger (liftLoc, runLoggingT)
import Database.Persist.MySQL (createMySQLPool, myConnInfo,
myPoolSize, runSqlPool)
import Database.Persist.Postgresql (createPostgresqlPool, pgConnStr,
pgPoolSize, runSqlPool)
import Import
import Language.Haskell.TH.Syntax (qLocation)
import Network.Wai.Handler.Warp (Settings, defaultSettings,
@ -64,9 +64,9 @@ makeFoundation appSettings = do
logFunc = messageLoggerSource tempFoundation appLogger
-- Create the database connection pool
pool <- flip runLoggingT logFunc $ createMySQLPool
(myConnInfo $ appDatabaseConf appSettings)
(myPoolSize $ appDatabaseConf appSettings)
pool <- flip runLoggingT logFunc $ createPostgresqlPool
(pgConnStr $ appDatabaseConf appSettings)
(pgPoolSize $ appDatabaseConf appSettings)
-- Perform database migration using our application's logging settings.
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc

View file

@ -11,7 +11,7 @@ import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
(.:?))
import Data.FileEmbed (embedFile)
import Data.Yaml (decodeEither')
import Database.Persist.MySQL (MySQLConf)
import Database.Persist.Postgresql (PostgresConf)
import Language.Haskell.TH.Syntax (Exp, Name, Q)
import Network.Wai.Handler.Warp (HostPreference)
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
@ -24,7 +24,7 @@ import Yesod.Default.Util (WidgetFileSettings, widgetFileNoReload,
data AppSettings = AppSettings
{ appStaticDir :: String
-- ^ Directory from which to serve static files.
, appDatabaseConf :: MySQLConf
, appDatabaseConf :: PostgresConf
-- ^ Configuration settings for accessing the database.
, appRoot :: Text
-- ^ Base for all generated URLs.

View file

@ -18,12 +18,12 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
# skip-combining: false
database:
user: "_env:MYSQL_USER:yammat"
password: "_env:MYSQL_PASSWORD:yammat"
host: "_env:MYSQL_HOST:localhost"
port: "_env:MYSQL_PORT:5432"
database: "_env:MYSQL_DATABASE:yammat"
poolsize: "_env:MYSQL_POOLSIZE:10"
user: "_env:PGUSER:yammat"
password: "_env:PGPASS:yammat"
host: "_env:PGHOST:localhost"
port: "_env:PGPORT:5432"
database: "_env:PGDATABASE:yammat"
poolsize: "_env:PGPOOLSIZE:10"
#analytics: UA-YOURCODE
email: "nek0@momen"

View file

@ -65,7 +65,7 @@ library
, bytestring >= 0.9 && < 0.11
, text >= 0.11 && < 2.0
, persistent >= 2.0 && < 2.2
, persistent-mysql >= 2.1.2 && < 2.2
, persistent-postgresql >= 2.1.2 && < 2.2
, persistent-template >= 2.0 && < 2.2
, template-haskell
, shakespeare >= 2.0 && < 2.1