yesodweb / yesodweb.com-content

Content for the www.yesodweb.com site
http://www.yesodweb.com/
Other
67 stars 112 forks source link

Migrations example on Persistent page doesn't compile due to entityDefs not being defined #280

Closed smheidrich closed 1 month ago

smheidrich commented 1 month ago

When I try to compile the code example from the Migrations section of the Persistent page, after fixing a small issue that the compiler explains how to fix¹, I still get an error like:

    Variable not in scope: entityDefs :: [EntityDef]
    Suggested fix:
      Perhaps use one of these:
        ‘entityDef’ (imported from Database.Persist.Sqlite),
        ‘entityKey’ (imported from Database.Persist.Sqlite)
   |
39 |     runMigration $ migrate entityDefs $ entityDef (Nothing :: Maybe Person)
   |                            ^^^^^^^^^^

Seems to me like it's because there is a missing mkEntityDefList "entityDefs" in the persist block.


¹ Namely, that language extensions StandaloneDeriving and FlexibleInstances are required, but let's make that a separate issue because I think it affects most of the examples, not just the Migrations one.