You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to migrate my code to the latest version of persistent, so I can support GHC 9.x, however I'm running into some issues with the API changes and it's unclear how to do the same in the new API.
With the new persistent interface I get stuck, embedEntityDefs now expected UnboundEntityDef arguments, but the output of the mkPersist quasi quoter gives me a regular EntityDef. I think I'm supposed to use mkPersistWith to manually pass in the entities I depend on, but this is unclear since the documetation for it is missing (see #1439).
I tried taking this approach of manually passing in the EntityDef I depend on at each invocation of mkPersistWith, but this doesn't seem to work. In my 2.14 branch (https://github.com/merijn/Belewitte/compare/persistent) I explicitly pass in all needed entities to mkPersistWith, but somehow migrateModels or something else does not seem to correctly get all the foreign references, as actually using this code throws away every single foreign reference in my
database, which is rather inconvenient to say the least...
So I'm just kinda lost on how to "properly" have my models split across modules in the 2.14 world.
The text was updated successfully, but these errors were encountered:
I'm trying to migrate my code to the latest version of persistent, so I can support GHC 9.x, however I'm running into some issues with the API changes and it's unclear how to do the same in the new API.
Essentially, I was using independent definition in separate files for my various entities and then in the end using
embedEntityDefs
andmigrate
to fix up the foreign keys (see https://github.com/merijn/Belewitte/blob/master/benchmark-analysis/src/Schema/Utils.hs#L54-L57).With the new persistent interface I get stuck,
embedEntityDefs
now expectedUnboundEntityDef
arguments, but the output of themkPersist
quasi quoter gives me a regularEntityDef
. I think I'm supposed to usemkPersistWith
to manually pass in the entities I depend on, but this is unclear since the documetation for it is missing (see #1439).I tried taking this approach of manually passing in the
EntityDef
I depend on at each invocation ofmkPersistWith
, but this doesn't seem to work. In my 2.14 branch (https://github.com/merijn/Belewitte/compare/persistent) I explicitly pass in all needed entities tomkPersistWith
, but somehowmigrateModels
or something else does not seem to correctly get all the foreign references, as actually using this code throws away every single foreign reference in mydatabase, which is rather inconvenient to say the least...
So I'm just kinda lost on how to "properly" have my models split across modules in the 2.14 world.
The text was updated successfully, but these errors were encountered: