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

Introspection adds an extra space to map properties in enums in prisma.schema #8479

Closed
vktrl opened this issue Jul 28, 2021 · 2 comments · Fixed by prisma/prisma-engines#2185
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! kind/bug A reported bug. team/schema Issue for team Schema. topic: introspection

Comments

@vktrl
Copy link

vktrl commented Jul 28, 2021

Bug description

For some reason, introspection messes up indentations of enums. A single space is added and maintained during introspection. Map properties for tables don't get an extra space. While it's a minor issue, it's a bit annoying because the space gets removed by the formatter and added back by Prisma on every edit/introspection and the changes get added to commits.

How to reproduce

  1. Introspect a schema with enums (Postgres)
  2. Change the enum name and add @@Map("db_enum_name") property
  3. Inspect again and see that there's a single space added in front of @@Map("db_enum_name")

Expected behavior

I would like it if the introspection wouldn't mess with formatting

Prisma information

Example:

model MyTable {
  myId  Int @unique @map("my_id")
  enum MyEnum

  @@map("my_table")
}

enum MyEnum {
  foo
  bar

   @@map("my_enum")
}

Environment & setup

  • OS: Debian Buster
  • Database: Postgres
  • Node.js version: 14
  • VSCode 1.57.1 with Prisma extension v2.27.0

Prisma Version

2.26
@vktrl vktrl added the kind/bug A reported bug. label Jul 28, 2021
@janpio janpio added topic: introspection bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. team/schema Issue for team Schema. good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! labels Jul 29, 2021
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. and removed bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Jul 29, 2021
@tomhoule tomhoule added this to the 2.31.0 / 3.0.x milestone Aug 25, 2021
@tomhoule tomhoule self-assigned this Aug 25, 2021
tomhoule added a commit to prisma/prisma-engines that referenced this issue Aug 25, 2021
@tomhoule
Copy link
Contributor

Hey @vkrtl, thanks for reporting the problem, it's indeed a bug. The fix is there, should be merged very soon: prisma/prisma-engines#2185

tomhoule added a commit to prisma/prisma-engines that referenced this issue Aug 25, 2021
tomhoule added a commit to prisma/prisma-engines that referenced this issue Aug 26, 2021
@tomhoule
Copy link
Contributor

The PR is merged, it will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! kind/bug A reported bug. team/schema Issue for team Schema. topic: introspection
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants