I suggest we follow a few conventions with the Prisma schema with Postgres and, generally, a SQL database/dialect.
@map attribute
Using the @map attribute, any fields named in the schema using camelCase should be mapped to their respective column name using snake_case.
For example, with #37, there's a plan to change the field <User>.name to <User>.displayName.
We can add the attribute @map("display_name") to commit this change to the database.
As most of us with Prisma knowledge know, we still use .displayName in the schema and Prisma Client. But display_name would be used in the database instead.
@@map
This is very similar to the @map attribute. However, with @@map, we map the model name to its respective database table name to follow the snake_case standard.
We currently have a User model defined. Following this standard, we can place @@map("users") at the end of the model to prepare to commit these changes.
These are the conventions I have in mind right now. As the repo progresses, I'll watch for changes to the schema!
Hello!
I suggest we follow a few conventions with the Prisma schema with Postgres and, generally, a SQL database/dialect.
@map
attributeUsing the
@map
attribute, any fields named in the schema usingcamelCase
should be mapped to their respective column name usingsnake_case
.For example, with #37, there's a plan to change the field
<User>.name
to<User>.displayName
. We can add the attribute@map("display_name")
to commit this change to the database.As most of us with Prisma knowledge know, we still use
.displayName
in the schema and Prisma Client. Butdisplay_name
would be used in the database instead.@@map
This is very similar to the
@map
attribute. However, with@@map
, we map the model name to its respective database table name to follow thesnake_case
standard.We currently have a
User
model defined. Following this standard, we can place@@map("users")
at the end of the model to prepare to commit these changes.These are the conventions I have in mind right now. As the repo progresses, I'll watch for changes to the schema!