is there a reason why Prisma defaults table names ...
# prisma-client
i
is there a reason why Prisma defaults table names to capital letters ? like model User {} creates table User? That naming structure is explicitly shunned by postgres
r
We generally follow this convention that most JavaScript devs use. To keep database names to what Postgres recommends, you can use
@map
and
@@map
as described here.
j
You can also just use lower case names! What we use in the docs is just a suggestion. If you database already uses lowercase, your schema will be lowercase. And when you create things, you can create them any way you want!
i
Based on what the people in #postgres have told me it seems like Prisma should maybe change it's recommendation. The convention that Prisma recommends could apparently cause honest issues for people further down the road
j
Why? What are possible problems of not using some specific naming strategy for Postgres databases? Besides that: This is a Prisma schema level recommendation. With
@@map
you can name your underlying database table whatever you want.
maybe prisma should mention in the docs "if you're working with postgres we recommend this other naming convention".. otherwise, if you give people a footgun then they're gonna shoot themselves in the foot (see: Rails mass assignment vulnerability)
j
That's a reasonable request for https://github.com/prisma/docs - suggestions where to put it and how to word that welcome.