question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

prisma format does not work correctly

See original GitHub issue

Bug description

prisma format adds relations in the wrong model

How to reproduce

Before saving Screen Shot 2022-11-24 at 11 15 43 PM After Saving Screen Shot 2022-11-24 at 11 15 51 PM

Expected behavior

It suppose to be Screen Shot 2022-11-24 at 11 16 08 PM

Prisma information

prisma : 4.6.1 @prisma/client : Not found Current platform : darwin Query Engine (Node-API) : libquery-engine 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/libquery_engine-darwin.dylib.node) Migration Engine : migration-engine-cli 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/migration-engine-darwin) Introspection Engine : introspection-core 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/introspection-engine-darwin) Format Binary : prisma-fmt 694eea289a8462c80264df36757e4fdc129b1b32 (at node_modules/@prisma/engines/prisma-fmt-darwin) Format Wasm : @prisma/prisma-fmt-wasm 4.6.1-3.694eea289a8462c80264df36757e4fdc129b1b32 Default Engines Hash : 694eea289a8462c80264df36757e4fdc129b1b32 Studio : 0.476.0

Environment & setup

  • OS: macOS
  • Database:PostgreSQL
  • Node.js version: v16.14.2

Prisma Version

4.6.1

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
janpiocommented, Nov 25, 2022

Similar question then: How should Prisma know if you want to do a 1:1 or a 1:n relation? We seem to have made the decision that a 1:n is more probable and default to that.

0reactions
davidizaccommented, Nov 25, 2022

@tomhoule how can you say that both are equally valid ? The “wrong” format created an array type I agree that they are 2 choices when it comes to apply a 1 - 1 relation, but in both of them, there is no array type… I would expect (at least) to get something like user User in the Profile model.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic alignment no longer works · Issue #40 - GitHub
Hi. I am not sure if I am doing something wrong, but since today, automatic formatting/alignment of schema.prisma file no longer works.
Read more >
VSCode Prisma extension not formatting - Stack Overflow
Prisma extension suddenly stopped formatting my schema. prisma with the proper indention. Below is the language server output after save. I ...
Read more >
Configuring error formatting (Concepts) - Prisma
This page explains how to configure the formatting of errors when using Prisma Client.
Read more >
Prisma schema (Reference)
Prisma supports formatting .prisma files automatically. There are two ways to format .prisma files: Run the prisma format command.
Read more >
Prisma docs style guide: spelling, punctuation, and formatting
This section of the style guide provides guidelines on how to present the ... If you are in doubt about whether to emphasize...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found