Does this workflow seem correct to everyone? I am ...
# orm-help
c
Does this workflow seem correct to everyone? I am trying to rename the fields coming out of the DB using
@map
in the schema file (image attached) Once I make a change I run
yarn prisma generate
and the
.prisma/client
folder is updated in
node_modules
Looking at the index.js file, nothing seems to be changed and I am still getting the column name (image attached). Seems like it is ignoring
@map
. Am I doing something wrong. This seems so simple but yet I am banging my head against the wall. Any help would be greatly appreciated. Running the latest version of
prisma
and
@prisma/client
.
t
2 questions. What’s the field name in your underlying DB (not in Prisma)? What would you like the field name to be in Prisma?
c
All column names are pascal case. I would like them to be camel case. So I would like
FirstName
to become
firstName
Had to resort to this. Its a pain but getting the correct result
t
if that’s the case you need to swap the values. So you would have
Copy code
firstName       string?        @map("FirstName")
that assumes you want to use
firstName
within prisma client and FirstName is the actual field name in your DB.
side-note but the name argument isn’t required
c
That is the expected result. I would like the prisma client to be
firstName
and the DB column name is
FirstName
Thank you for pointing out the name arguement. I was trying everything I could think of haha
t
no worries, so yeah try the line I sent you.
c
Thank you so much. That worked.
t
sweet!