Skip to content

Instantly share code, notes, and snippets.

@lagenorhynque
Created December 15, 2017 12:31
Show Gist options
  • Select an option

  • Save lagenorhynque/03a5a9b7743809c1005d1b754cf83792 to your computer and use it in GitHub Desktop.

Select an option

Save lagenorhynque/03a5a9b7743809c1005d1b754cf83792 to your computer and use it in GitHub Desktop.
{-# 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