Skip to content

Magic introspection naming #1705

Open
Open

Description

@timsuchanek

If you introspect a TypeORM or Sequelize (or most other ORMs) schema, you more often than not end up with a schema like so:

model users {
  id Int @id
}

model posts {
  id     Int @id
  userId users
}

The entities in TypeORM are called User and Post, so for a user coming from these libraries, the naming now is not what they are used to and also goes against the default conventions we have with Prisma.

Optimally we would instead perform heuristics that introduce a couple of @map's that transform the schema like so:

model User {
  id Int @id

  @@map("users")
}

model Post {
  id     Int @id
  user   User @map("userId")

  @@map("posts")
}

We should take into account the naming conventions of various popular frameworks (non-exhaustive):

  • Django
  • Active Record
  • Sequelize
  • TypeORM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions