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.

@@unique is no longer allowed for relations in vscode plugin

See original GitHub issue

Problem

i had a model like this:

model TeamChallengeVote {
  id           String              @default(uuid()) @id
  user      User      @relation(references: [id])
  challenge Challenge @relation(references: [id])
  team      Team?     @relation(references: [id])
  score     Int

  @@unique([user, challenge, team])
}

until yesterday, this was valid. But since today, vscode complains about the @@unique annotation:

Error validating model "TeamChallengeVote": The unique index definition refers to the relation fields user, challenge, team. Index definitions must reference only scalar fields.

i guess this is of the new beta which unfortunatly requires additional scalar fields. So the formatter already threats the schema as beta, altough we still use preview

Solution

maybe the formatter just needs to know the prisma version for the time being and treat at as preview schema. Its very very hard for the moment to know how to migrate properly, everything seems to fall apart.

Alternatives

Have the formatter automatically update every schema in a way that it works both for preview version and beta. Maybe release another preview that supports the new scalar fields and have the migration handle this gracefully. Or get rid of the scalar-fields again on beta.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
macrozonecommented, Mar 26, 2021

👍

the good formatter in vscode really helped to adopt anyway as it adds missing pieces

0reactions
do4grcommented, Mar 26, 2021

Closing this now since the syntax change was completed more than 6 months ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contribution Points | Visual Studio Code Extension API
Contribution Points. Contribution Points are a set of JSON declarations that you make in the contributes field of the package.json Extension Manifest.
Read more >
Managing Extensions in Visual Studio Code
An extension is uniquely identified by its publisher and extension IDs. ... Ignored recommendations will no longer be recommended to you. Ignore extension...
Read more >
Custom Editor API - Visual Studio Code
Custom Editor API. Custom editors allow extensions to create fully customizable read/write editors that are used in place of VS Code's standard text...
Read more >
Tree View API - Visual Studio Code
A guide to using Tree View in Visual Studio Code extension (plug-in). ... The Tree View API allows extensions to show content in...
Read more >
Visual Studio Code for the Web
We expect more extensions to become enabled over time. Limited extension support. When you install an extension, it is saved in the browser's...
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