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

incompatible operand typeszmodel #359

Open
jasonmacdonald opened this issue Sep 5, 2024 · 0 comments
Open

incompatible operand typeszmodel #359

jasonmacdonald opened this issue Sep 5, 2024 · 0 comments

Comments

@jasonmacdonald
Copy link
Contributor

jasonmacdonald commented Sep 5, 2024

VScode throws an inline error here.

The solution is to define the @@auth attribute on the User

datasource db {
    provider = 'sqlite'
    url = 'file:.dev.db'
}

model User {
    id    Int    @id @default(autoincrement())
    posts Post[]
    @@auth
}

model Post {
    id       Int    @id @default(autoincrement())
    title    String
    author   User   @relation(fields: [authorId], references: [id])
    authorId Int

    @@allow('all', auth() == author)
}

I will hold off submitting a PR since this is only an issue in the VScode plugin, but it could throw off any users trying to follow the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant