Hello there :wave: Is it normal behavior for my r...
# orm-help
a
Hello there 👋 Is it normal behavior for my relation fields to be autocapitalized when I format with the Prisma extension? Example:
Copy code
model Customer {
  id        String     @id @default(cuid())
  createdAt DateTime   @default(now())
  updatedAt DateTime   @updatedAt 
  Proposal  Proposal[] // this relation field name was autocapitalized!
}
If this is normal, what is the reasoning behind it? 🤔
j
That usually only happens if the relation field was automatically added by the formatting, as the back relation to an existing relation in
Proposal
pointing to
Customer
. The logic just uses the model name - in this case
Proposal
for that.
Does that make sense and match what happened?
a
Ohhh, I see. I think it would be easier if the name was inferred from the relation type (if it is many to one, the relation field could be plural). Thank you
j
We did that before. Turns out people have database schema names in Chinese or German - and adding an
s
to that end does not work very well 😄
We also had
FooRelation
for some time - but that is definitely shitty all the time so we decided to just go with what we really know.
But yep, generally not suuuuuper happy with this.
Prompting for user confirmation would also be an option if this happens in an IDE, but for big schemas that could mean a few hundred prompts. Also not cool.