Closed exi closed 9 years ago
You need to use defdb
:
(defdb db (h2 {...}))
I was using defdb, i just forgot to paste that line of code. I edited it for clarity. I just realized that this issue is the same that is addressed here: https://github.com/korma/Korma/pull/268
Actually, I have been meaning to open an issue, but I never seem to have the time for a pull request and it seems relevant here.
defdb
sets the default naming, which is great but with-db
doesn't honor what is set for the specific database. I figure it's not a huge issue since I use the same naming on all my databases, but it seems like a bug to me. If nothing else - it have no other reason to use defdb
.
@exi: If you think this is the same as #268, have you omitted the entity transforms also "for clarity"? I still cannot reproduce this with your code example.
@ls4f: Looking at the code, that seems to be the case with with-db
. Pull request welcome :)
@immoh you are absolutely right. I already deleted my code when i replied earlier. I just realized that i didn't use "defdb" but "create-db".
My apologies for the pointless confusion. A complete example project can be found here: https://github.com/exi/korma-example
Just executing "lein run" will print:
SELECT "MESSAGES"."ID", "MESSAGES"."MESSAGE", "MESSAGES"."TIMESTAMP", "USERS"."id", "USERS"."name", "USERS"."last_seen" FROM "MESSAGES" LEFT JOIN "USERS" ON "USERS"."id" = "MESSAGES"."USERS_id"
I will update the issue title and initial description to properly reflect the error. The expected behavior would be that the naming function is properly applied when using "create-db" as well as "defdb".
@exi You're using old version of Korma. It works correctly with 0.4.0.
@immoh Thanks for the response. Could you please redeploy "http://sqlkorma.com/docs" from the current repository version? The website is still stating:
;; First you'll need to add Korma as a dependency in your lein/cake project:
[korma "0.3.0"]
Oh crap, it still has old version. Unfortunately I don't have access to do it.
@ibdknox: any chance to get sqlkorma.com updated?
sqlkorma.com is now up-to-date.
I created separate issue for bug reported by @ls4f: #282 so that I can close this.
I have this configuration:
When joining entities with (with) the naming functions is not applied on the joined entity, leading to incorrect lower case column names in my example: