I’m having an issue where my prisma schema gets up...
# orm-help
b
I’m having an issue where my prisma schema gets updated every time I introspect, here’s the workflow: 1. I make changes to my db with plain sql 2. I introspect my db 3. Prisma schema gets generated 4. I update some values for easier understanding to the prisma client 5. I introspect again 6. Prisma schema gets updated again (overwriting my custom field changes) Here’s an example: Generated by prisma after introspect:
Copy code
model Tag {
  id      Int       @id @default(autoincrement())
  name    String    @unique
  post    Post[]    @relation("post_to_tag")

  @@map("tag")
}
Modified my by afterwards:
Copy code
model Tag {
  id      Int       @id @default(autoincrement())
  name    String    @unique
  posts   Post[]    @relation("post_to_tag")  <-------- posts instead of post

  @@map("tag")
}
Introspects again and overwrites my changes with the 1st code block again. Any idea why this could be happening? 🙂
Oh I see it’s a work in progress https://github.com/prisma/prisma/issues/2502
r
Hey @bntzio 👋 Yes unfortunately this is a bug currently and we are working on this one 🙂
👍 3
d
@bntzio Which version of Prisma are you using?
b
@Daniel Norman 2.12.1
d
Hey @bntzio, what you’re trying to do should already work. Introspect should retrieve your manually changed names from previous schema and keep them. So what you’re seeing looks like a bug, maybe caused by the combination with @@map on the model. I’ll open an issue to test and possibly fix this.
🙏 2
b
Hey @do4gr thanks! I just tried again without the mapping and it’s still changing my schema
Should I remove the pkg and install it again? because before the @@map I remember it was working fine
d
Hey, thanks for trying that. I can also reproduce it locally, so no need for you to try more. You can follow the linked issue to be notified once it is fixed.
🙌 1
b
Awesome thanks @do4gr!