Skip to content

Reintrospection Bug on Relations #4582

@do4gr

Description

@do4gr

From a report in Slack:

I’m having an issue where my prisma schema gets updated every time I introspect, here’s the workflow:

  • I make changes to my db with plain sql
  • I introspect my db
  • Prisma schema gets generated
  • I update some values for easier understanding to the prisma client
  • I introspect again
  • Prisma schema gets updated again (overwriting my custom field changes)

Here’s an example:
Generated by prisma after introspect:

model Tag {
  id      Int       @id @default(autoincrement())
  name    String    @unique
  post    Post[]    @relation("post_to_tag")
  @@map("tag")
}

Modified my by afterwards:

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.

https://prisma.slack.com/archives/CA491RJH0/p1607487789070000

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions