Hacker News new | ask | show | jobs
by JoelJacobson 1632 days ago
It would indeed be difficult to remember, but the proposal also suggest changing the default naming convention for foreign keys, to give them the same name as the referenced table.

If using an ORM, I would guess this proposal isn't useful, since then you wouldn't hand-write queries anyway, right? Except when you want to override the queries generated by the ORM? (I'm not an ORM user myself.)

1 comments

Speaking as someone who has used ORMs in the past and contributes to a LINQ Micro ORM...

It might make tooling 'easier', but since backwards compatibility has to be considered the actual value add is questionable IMO.

Most ORMs/MicroORMs will have tooling that sniffs out the DB Schema including foreign keys, and if you are using those bits (i.e. 'not hand written') most will do the right thing today. I suppose you could include some extra syntax for whatever DSL you're providing users....

IDK. Speaking as someone who is very comfortable in SQL, This feels more like syntactic sugar than anything else.

Could you please elaborate on this FK sniffing, and which tools are actually implementing that?
Ahhh, I know that Entity Framework would do this at one point, IDK if EF Core does or not.

Linq2Db does it via T4 Template generation, so you can play with it more if you want [0]

[0] - https://github.com/linq2db/linq2db/blob/64a0db9a9ed7787ff755...