zenstack
zenstack copied to clipboard
false error on @relation in vscode extension when using multiple schemas
Description and expected behavior
false error values of "references" and "fields" must have the same type
, when the type actually the same and zenstack generate
creates correct schema. this is an issue with vscode+intelij extensions.
// /zmodel/base.zmodel
import "../schema"
abstract model Base {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt()
// require login
@@deny('all', auth() == null)
// allow all operations for admin
@@allow('all', auth().role.name == 'Admin')
}
model User extends Base {
name String
email String @unique
profilePic String
role Role @relation(fields: [roleId], references: [id])
roleId String
serviceResearches Service2Researcher[]
@@allow('read', true)
}
model Role extends Base {
name String @unique
users User[]
@@allow('read', true)
}
// /schema.zmodel
import "zmodel/base"
model Demo extends Base {
stages DemoStage[] @relation("stages")
}
model DemoStage extends Base {
owned_stages Demo? @relation("stages", fields: [demoId], references: [id])
demoId String?
}
same on base by the way
Environment (please complete the following information):
- ZenStack version: 1.12.3
- Prisma version: 5.11.0
- Database type: Postgresql
update: this bug is only in vscode, but not in intelij
Hi @tmax22 , which version of VSCode extension are you using? I tried both the latest and the prerelease one but couldn't reproduce it.
Version: 1.88.1 Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:34:12.840Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 5.15.150.1-microsoft-standard-WSL2 snap
I'm not sure what happened, but now vscode error has gone, but the same error appears on Webstorm now 🙃
I'm not sure what happened, but now vscode error has gone, but the same error appears on Webstorm now 🙃
Are you using the V2 prerelease version of VSCode extension? It might be an issue fixed in the v2 release but there isn't a version for it for webstorm yet.
nope. im on the normal stable release vscode extension. I'm not sure what's going on and why this happens only sometimes
I'm closing it for now. Please reopen if it happens again.