I am still quite new to Yesod so I might be missing something essential.
My understanding is that adding the Maybe
attribute to a Persist Entity field seems to both make the attribute non nullable in the database as well as wrapping it in a Maybe in the Data definition. I tried creating a test Entity with a timestamp that has a default=CURRENT_TIME
. If I now send a JSON representation of this entity without the timestamp, I get an error about the missing timestamp when I try to use requireJsonBody
. I guess I could add Maybe
to the timestamp to get the JSON parsing to succeed. But then I would not have the non null constraint for the column in the database anymore?