-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistent2 custom primary keys are not supported #87
Comments
I haven't tried the new feature at all, I'm not actually very familiar with it. @gregwebs do you have any ideas on what changes to esqueleto might by necessary to add support? |
I have never looked at esqueleto source code. It is likely assuming an id field exists rather than getting the actual column name. |
The assumptions are encoded on the Does anyone want to take a stab at this? |
Thanks for the pointer to the esqueleto code.
The persistent code base checks the We should expose some of that functionality from persistent so that it does not need to be duplicated in esqueleto. |
I believe @gbwey took a stab at supporting composite primary keys (which I assume is a more general case of this concrete "custom pk" case) a couple of months ago here. However, I've tried merging his fork and and linking against it but the problem remains :( I'm still a bit overwhelmed with persistent/esqueleto's internals (I still consider myself a Haskell noob) but I think I might be able to give it a stab taking some inspiration from @gbwey's patch. Feel free to beat me to it though... :) |
I've just took a stab at it and it seems to work :). See pull requests above. |
Unfortunately I'm still getting the same error when compiling my app against the code from PR #88 (even though the unit tests I made pass !?). Perhaps its a stupid mistake on my part (like linking against old code, or whatever... I'm hungry) or maybe it is related to returning a tuple of entities instead of a single one, or related to the joins... I'll investigate later when I have some rest and sugar in my blood. |
I'm trying to upgrade an existing application to latest Persistent2 and custom primary keys do not seem to be supported. My model definition is
selecting/inserting
Frontcover
rows via Persistent2 works as expected, however, when trying to use theFrontcover
entity in an Esqueleto query a runtime error is raised since afrontcover.id
spurious columns is generated in the SQL.The error is:
An the Esqueleto query is:
Perhaps I'm missing something or doing something wrong?
The text was updated successfully, but these errors were encountered: