From f0ba72d536335a2c54fe44d5702362afd6c9a216 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 26 Oct 2010 11:01:56 +0200 Subject: [PATCH] Using mkMigrate in scaffolding --- Yesod/Form.hs | 2 +- Yesod/Form/Jquery.hs | 1 + scaffold/Controller_hs.cg | 4 +--- scaffold/Model_hs.cg | 4 +++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Yesod/Form.hs b/Yesod/Form.hs index bf807f29..cb28907c 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -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` diff --git a/Yesod/Form/Jquery.hs b/Yesod/Form/Jquery.hs index 90bbd7aa..7158be4a 100644 --- a/Yesod/Form/Jquery.hs +++ b/Yesod/Form/Jquery.hs @@ -13,6 +13,7 @@ module Yesod.Form.Jquery , jqueryDayFieldProfile , googleHostedJqueryUiCss , JqueryDaySettings (..) + , Default (..) ) where import Yesod.Handler diff --git a/scaffold/Controller_hs.cg b/scaffold/Controller_hs.cg index 35ff7506..96885c3d 100644 --- a/scaffold/Controller_hs.cg +++ b/scaffold/Controller_hs.cg @@ -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 diff --git a/scaffold/Model_hs.cg b/scaffold/Model_hs.cg index 3602e7ce..7ad3062d 100644 --- a/scaffold/Model_hs.cg +++ b/scaffold/Model_hs.cg @@ -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