prismix
prismix copied to clipboard
Attribute not known @db.VarChar
It appears that support for specific DB types isn't supported.
I'm merging:
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["orderByAggregateGroup", "selectRelationCount"]
}
model Company {
id Int @id @default(autoincrement())
createdDate DateTime @default(now())
updatedDate DateTime?
name String
}
with:
model JobGroup {
id Int @id @default(autoincrement())
createdDate DateTime @default(now())
updatedDate DateTime?
company Company @relation(fields: [companyId], references: [id])
companyId Int
user User @relation(fields: [userId], references: [id])
userId Int
name String @db.VarChar(255)
default Boolean @default(false)
color String? @db.VarChar(30)
}
model Company {
id Int @id @default(autoincrement())
}
model User {
id Int @id @default(autoincrement())
}
It's valid prisma.schema syntax.
Are there any plans to support this?
Hey after looking into this i believe this has nothing to do with Prismix and seems to be an issue with the prisma SDK

The error is thrown by like 36 on the above image in this file which is a function provided by the prisma SDK.
But then again i've dug around the prisma code and they use the exact same function that we're calling 😢
Ooof, a bug in prisma - what are the chances 😅
Are you planning on chasing this up with them or not? I need to know as I'll have to find another solution for multi file if you're not as it's a key part of my pluggable structure. I'm not in a rush, just need to know if it'll be sorted at some point.
By all means I’ll take a look at it on our side as there has to be a reason why this works when prisma call this function but not when we call it…
Maybe @jamiepine had an idea why this is being serialised differently on our end
I ran into this same issue. My solution was to include the datasource in every file that uses @db. types:
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model JobGroup {
name String @db.VarChar(255)
// etc.
}
Given that the error with the missing datatype is coming from the prisma SDK itself, it probably won't be possible to fix within the context of prismix.