Skip to content

incompatible operand typeszmodel #359

Open
@jasonmacdonald

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions