is it convention in the prisma schema to have scal...
# orm-help
m
is it convention in the prisma schema to have scalar fields camelCase and Relation fields be CapitalCase?
r
Yes that’s the general convention followed.
👍 1
m
thanks!
👍 1
but is a relation field a table or a column?
seems ambiguous to me
r
A relation field would be a column in that case.
m
so the relation should be camelCase
r
Yes
m
but if I delete a relation and run
prisma format
then it recreates the relation "column" in PascalCase not camelCase
r
I had seen an issue about that but I don’t remember where. @janpio must have a better idea.
j
prisma format
usually creates the relation, not the relation scalar field. Generally Prisma does not try to come up with any names, but uses whatever is already there. In this case it should be the name of the "target" model of the relation.
If it does fill in the relation scalar as well, that is also just an suggestion for the user to build from. If we tried to fit that into the suggested naming scheme, it might or might not work out well.
m
so is the convention that relation fields should be PascalCase? since the model names should be PascalCase?
j
No, that is just the only thing the automated creation of these can use.
Generally many people use camelCase on that one as well.
I don't think we have a defined, specific convention for these.
m
I just want to do whatever is 'normal' or 'best'
j
Best is what works for you, and makes sense in comparison what else you have.
I would go with camelCase for all fields, including relations. And PascalCase the models only.
(Which means to adapt what the automated relations get as name)
m
gotcha thx!
prisma rainbow 1