Using mkMigrate in scaffolding

This commit is contained in:
Michael Snoyman 2010-10-26 11:01:56 +02:00
parent d3a9201b27
commit f0ba72d536
4 changed files with 6 additions and 5 deletions

View File

@ -243,7 +243,7 @@ mkToForm =
let x = foldl (ap' ap) just' $ map (go' ffs' stm string') a
in ftt `AppE` x
go' ffs' stm string' (((theId, name), ((label, tooltip), tff)), ex) =
let label' = string' `AppE` LitE (StringL label)
let label' = LitE $ StringL label
tooltip' = string' `AppE` LitE (StringL tooltip)
ffs = ffs' `AppE`
label' `AppE`

View File

@ -13,6 +13,7 @@ module Yesod.Form.Jquery
, jqueryDayFieldProfile
, googleHostedJqueryUiCss
, JqueryDaySettings (..)
, Default (..)
) where
import Yesod.Handler

View File

@ -32,9 +32,7 @@ getRobotsR = return $ RepPlain $ toContent "User-agent: *"
-- migrations handled by Yesod.
with~sitearg~ :: (Application -> IO a) -> IO a
with~sitearg~ f = Settings.withConnectionPool $ \p -> do
flip runConnectionPool p $ runMigration $ do
migrate (undefined :: User)
migrate (undefined :: Email)
runConnectionPool (runMigration migrateAll) p
let h = ~sitearg~ s p
toWaiApp h >>= f
where

View File

@ -2,11 +2,13 @@
module Model where
import Yesod
import Database.Persist.TH (share2)
import Database.Persist.GenericSql (mkMigrate)
-- You can define all of your database entities here. You can find more
-- information on persistent and how to declare entities at:
-- http://docs.yesodweb.com/book/persistent/
mkPersist [$persist|
share2 mkPersist (mkMigrate "migrateAll") [$persist|
User
ident String
password String null update