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

Missing code autocomplete for referential actions with mongodb #1676

Closed
milindgoel15 opened this issue Mar 3, 2024 · 2 comments · Fixed by prisma/prisma-engines#4844
Closed
Labels
bug/2-confirmed Bug has been reproduced and confirmed. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: autocompletion LSP text document completion topic: mongodb
Milestone

Comments

@milindgoel15
Copy link

Bug description

Not sure if this is a bug or a missing feature, but when adding any referential actions (onDelete or onUpdate), it does not give any auto-suggestion in vscode even while using the Prisma extension.

Normally it gives fields, names, references when creating any type of relation between models but it does not give for onDelete or onUpdate. Also all the support actions with it (Cascade, SetNull, etc).

How to reproduce

  1. Create a relation between 2 models,
  2. Try adding a referential action for say onDelete.
  3. Here, you have to type it it up all manually.

Expected behavior

the actions gets auto-suggested as to what type of relation you want to set.

Prisma information

generator client {
   provider = "prisma-client-js"
}

datasource db {
   provider = "mongodb"
   url      = env("DATABASE_URL")
}

model Post {
   id       String @id @default(auto()) @map("_id") @db.ObjectId
   title    String
   author   User   @relation(fields: [authorId], references: [id], onDelete: Cascade)
   authorId String @db.ObjectId
}

model User {
   id    String @id @default(auto()) @map("_id") @db.ObjectId
   posts Post[]
}

Environment & setup

  • OS: Windows 11
  • Database: MongoDB
  • Node.js version: v20.10.0

Prisma Version

Environment variables loaded from .env
prisma                  : 5.10.2
@prisma/client          : 5.10.2
Computed binaryTarget   : windows
Operating System        : win32
Architecture            : x64
Node.js                 : v20.10.0
Query Engine (Node-API) : libquery-engine 5a9203d0590c951969e85a7d07215503f4672eb9 (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine           : schema-engine-cli 5a9203d0590c951969e85a7d07215503f4672eb9 (at node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm             : @prisma/prisma-schema-wasm 5.10.0-34.5a9203d0590c951969e85a7d07215503f4672eb9
Default Engines Hash    : 5a9203d0590c951969e85a7d07215503f4672eb9
Studio                  : 0.499.
@milindgoel15 milindgoel15 added the kind/bug A reported bug. label Mar 3, 2024
@milindgoel15
Copy link
Author

Just a note, i am using the schema from referential actions docs with provider set to MongoDB to reproduce the issue.

@janpio janpio transferred this issue from prisma/prisma Mar 3, 2024
@Druue Druue added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: autocompletion LSP text document completion domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. labels Apr 16, 2024
@Druue Druue 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 Apr 29, 2024
@Druue
Copy link
Contributor

Druue commented Apr 29, 2024

Hey @milindgoel15, I can confirm what you're seeing as a bug, this is due to an issue in engines where we were using the incorrect set of referential actions specifically for completions offered by the extension.

There's a fix in review :)

@janpio janpio added this to the 5.14.0 milestone Apr 30, 2024
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. domain/schema Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc. kind/bug A reported bug. topic: autocompletion LSP text document completion topic: mongodb
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants