transplant to postgresql
This commit is contained in:
parent
d5c502b760
commit
684d8167ad
|
@ -7,8 +7,8 @@ module Application
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Logger (liftLoc, runLoggingT)
|
import Control.Monad.Logger (liftLoc, runLoggingT)
|
||||||
import Database.Persist.MySQL (createMySQLPool, myConnInfo,
|
import Database.Persist.Postgresql (createPostgresqlPool, pgConnStr,
|
||||||
myPoolSize, runSqlPool)
|
pgPoolSize, runSqlPool)
|
||||||
import Import
|
import Import
|
||||||
import Language.Haskell.TH.Syntax (qLocation)
|
import Language.Haskell.TH.Syntax (qLocation)
|
||||||
import Network.Wai.Handler.Warp (Settings, defaultSettings,
|
import Network.Wai.Handler.Warp (Settings, defaultSettings,
|
||||||
|
@ -64,9 +64,9 @@ makeFoundation appSettings = do
|
||||||
logFunc = messageLoggerSource tempFoundation appLogger
|
logFunc = messageLoggerSource tempFoundation appLogger
|
||||||
|
|
||||||
-- Create the database connection pool
|
-- Create the database connection pool
|
||||||
pool <- flip runLoggingT logFunc $ createMySQLPool
|
pool <- flip runLoggingT logFunc $ createPostgresqlPool
|
||||||
(myConnInfo $ appDatabaseConf appSettings)
|
(pgConnStr $ appDatabaseConf appSettings)
|
||||||
(myPoolSize $ appDatabaseConf appSettings)
|
(pgPoolSize $ appDatabaseConf appSettings)
|
||||||
|
|
||||||
-- Perform database migration using our application's logging settings.
|
-- Perform database migration using our application's logging settings.
|
||||||
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc
|
runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc
|
||||||
|
|
|
@ -11,7 +11,7 @@ import Data.Aeson (Result (..), fromJSON, withObject, (.!=),
|
||||||
(.:?))
|
(.:?))
|
||||||
import Data.FileEmbed (embedFile)
|
import Data.FileEmbed (embedFile)
|
||||||
import Data.Yaml (decodeEither')
|
import Data.Yaml (decodeEither')
|
||||||
import Database.Persist.MySQL (MySQLConf)
|
import Database.Persist.Postgresql (PostgresConf)
|
||||||
import Language.Haskell.TH.Syntax (Exp, Name, Q)
|
import Language.Haskell.TH.Syntax (Exp, Name, Q)
|
||||||
import Network.Wai.Handler.Warp (HostPreference)
|
import Network.Wai.Handler.Warp (HostPreference)
|
||||||
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
|
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
|
||||||
|
@ -24,7 +24,7 @@ import Yesod.Default.Util (WidgetFileSettings, widgetFileNoReload,
|
||||||
data AppSettings = AppSettings
|
data AppSettings = AppSettings
|
||||||
{ appStaticDir :: String
|
{ appStaticDir :: String
|
||||||
-- ^ Directory from which to serve static files.
|
-- ^ Directory from which to serve static files.
|
||||||
, appDatabaseConf :: MySQLConf
|
, appDatabaseConf :: PostgresConf
|
||||||
-- ^ Configuration settings for accessing the database.
|
-- ^ Configuration settings for accessing the database.
|
||||||
, appRoot :: Text
|
, appRoot :: Text
|
||||||
-- ^ Base for all generated URLs.
|
-- ^ Base for all generated URLs.
|
||||||
|
|
|
@ -18,12 +18,12 @@ ip-from-header: "_env:IP_FROM_HEADER:false"
|
||||||
# skip-combining: false
|
# skip-combining: false
|
||||||
|
|
||||||
database:
|
database:
|
||||||
user: "_env:MYSQL_USER:yammat"
|
user: "_env:PGUSER:yammat"
|
||||||
password: "_env:MYSQL_PASSWORD:yammat"
|
password: "_env:PGPASS:yammat"
|
||||||
host: "_env:MYSQL_HOST:localhost"
|
host: "_env:PGHOST:localhost"
|
||||||
port: "_env:MYSQL_PORT:5432"
|
port: "_env:PGPORT:5432"
|
||||||
database: "_env:MYSQL_DATABASE:yammat"
|
database: "_env:PGDATABASE:yammat"
|
||||||
poolsize: "_env:MYSQL_POOLSIZE:10"
|
poolsize: "_env:PGPOOLSIZE:10"
|
||||||
|
|
||||||
#analytics: UA-YOURCODE
|
#analytics: UA-YOURCODE
|
||||||
email: "nek0@momen"
|
email: "nek0@momen"
|
||||||
|
|
|
@ -65,7 +65,7 @@ library
|
||||||
, bytestring >= 0.9 && < 0.11
|
, bytestring >= 0.9 && < 0.11
|
||||||
, text >= 0.11 && < 2.0
|
, text >= 0.11 && < 2.0
|
||||||
, persistent >= 2.0 && < 2.2
|
, 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
|
, persistent-template >= 2.0 && < 2.2
|
||||||
, template-haskell
|
, template-haskell
|
||||||
, shakespeare >= 2.0 && < 2.1
|
, shakespeare >= 2.0 && < 2.1
|
||||||
|
|
Loading…
Reference in a new issue