Is it safe to use `@@map` in `schema.prisma` like...
# orm-help
j
Is it safe to use
@@map
in
schema.prisma
like this
Copy code
model User {
  id        String @id @default(cuid())
  firstName String
  lastName  String
  email     String @unique
  password  String

  @@map("user")
}
Will there be any issue when introspecting later? I want my database table names to be in lowercase but the model names in schema to be in uppercase. Is it safe to use
@@map
like this? Or is there any better and safer way?
p
it is fine to use like this. If you introspect later, it will use the table names and won’t be aware of the
map
property.
You will have to manually change the schema after every introspect if you want to keep the models capitalize
j
@Pierre Ortega Isn't there any consistent and automated way for this instead of manual tweaking? This can be dangerous sometimes
p
you could write a script that does that to you. You would need to parse the .prisma file though
it shouldn’t be hard if you take a look in how prisma vscode integration works
j
Thanks I'll look into it
r
@J Giri 👋 There will be no issue here. Introspect will always recognise
@@map
and will keep it the same, so you just need to edit it once.
j
@Ryan Whoa That's great. Pleased and relieved to know 👏
💯 1