Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magic introspection naming #1705

Open
timsuchanek opened this issue Feb 25, 2020 · 1 comment
Open

Magic introspection naming #1705

timsuchanek opened this issue Feb 25, 2020 · 1 comment
Labels
domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/feature A request for a new feature. topic: introspection topic: introspection-configuration

Comments

@timsuchanek
Copy link
Contributor

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
@timsuchanek timsuchanek added process/candidate kind/improvement An improvement to existing feature and code. labels Feb 25, 2020
@nikolasburk
Copy link
Member

Related (or pretty much duplicate of: https://github.com/prisma/prisma2/issues/1325)

@divyenduz divyenduz added this to the Preview 24 New milestone Mar 3, 2020
@albertoperdomo albertoperdomo added the domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. label Nov 25, 2020
@janpio janpio added kind/feature A request for a new feature. and removed kind/improvement An improvement to existing feature and code. labels Sep 23, 2021
@janpio janpio changed the title Improve introspection naming Magic introspection naming Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/feature A request for a new feature. topic: introspection topic: introspection-configuration
Projects
None yet
Development

No branches or pull requests

6 participants