I have a schema which looks something like this:
share
[ mkPersist sqlSettings ]
[persistLowerCase|
RoleTable
name RoleName
deriving Generic Show
UserTable
roleId (Key RoleTable)
This results in a runtime exception:
PersistMarshalError "field roleId: int64 Expected Integer, received: PersistText \"1\""
If I use RoleTableId instead of (Key RoleTable) in UserTable everything works fine. This is perhaps not an expected usage of the DSL but the error was not caught. Perhaps something went wrong in the TH code generation from the schema and it compiled fine but resulted in a runtime error. If that's the case then the schema DSL can perhaps be made a bit more robust against unexpected usage.