Created
December 15, 2017 12:31
-
-
Save lagenorhynque/03a5a9b7743809c1005d1b754cf83792 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE EmptyDataDecls #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE GADTs #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE NoImplicitPrelude #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE TemplateHaskell #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| module Model where | |
| import ClassyPrelude.Yesod | |
| import Database.Persist | |
| import Database.Persist.Postgresql | |
| import Database.Persist.Quasi | |
| import Control.Monad.Logger | |
| -- You can define all of your database entities in the entities file. | |
| -- You can find more information on persistent and how to declare entities | |
| -- at: | |
| -- http://www.yesodweb.com/book/persistent/ | |
| share [mkPersist sqlSettings, mkMigrate "migrateAll"] | |
| $(persistFileWith lowerCaseSettings "config/models") | |
| connStr = "dbname=meetup host=localhost user=meetup password=password123 port=5432" | |
| main :: IO () | |
| main = runStdoutLoggingT $ withPostgresqlPool connStr 10 $ \pool -> | |
| liftIO $ flip runSqlPersistMPool pool $ do | |
| printMigration migrateAll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment