jermahs
jermahs
PPrisma
Created by jermahs on 10/14/2024 in #help-and-questions
MSSQL Include (Joins) Seem Case Sensitive
Observing the documentation, https://www.prisma.io/docs/orm/prisma-client/queries/case-sensitivity#microsoft-sql-server-provider and my knowledge of MSSQL I know that MSSQL is case insensitive. However, it has become apparent that prisma is some how forcing case sensitivity when using an include on a relationship. We observed this by having some legacy data that was lower case in one spot and a different case in another despite it being a FK. When doing a raw query this works as expected, but through prisma it fails with a null not allowed error message.
model Locations
...
relatedUser String @db.Nvarchar(256)
...
owner: UserInfo @relation('Locations_RelateduserToUserInfo', fields: [relatedUser], references: [Username])
...
}
model Locations
...
relatedUser String @db.Nvarchar(256)
...
owner: UserInfo @relation('Locations_RelateduserToUserInfo', fields: [relatedUser], references: [Username])
...
}
In our legacy production db we have a value in UserInfo.Username as "someuser", but the Locations.relatedUser is "SomeUser". Don't ask me why, I'm not happy with the casing issue within my database to begin with : / If you jsut run a raw query from SSMS or other query editor, then the following works
SELECT * FROM Locations L
INNER JOIN UserInfo UI ON UI.Username = L.RelatedUser
SELECT * FROM Locations L
INNER JOIN UserInfo UI ON UI.Username = L.RelatedUser
Unfortunately, if you run a query in prisma such as
await prisma.locations.findMany({
where: {
id: someLocationId,
},
include: {
owner: true
}
}
await prisma.locations.findMany({
where: {
id: someLocationId,
},
include: {
owner: true
}
}
then you'll get the following error: "PrismaClientUnknownRequestError"
Inconsistent query result: Field owner is required to return data, got `null` instead.
Inconsistent query result: Field owner is required to return data, got `null` instead.
Please help! We can obviously modify our data in our database, but we have some weird legacy requirements that I'd rather not contend with tat this time. Any help would be greatly appreciated! Thanks in advance!
2 replies
PPrisma
Created by jermahs on 5/28/2024 in #help-and-questions
Does Accelerate support MSSQL?
Does Prisma Accelerate support MSSQL? I don't know if I set it up right, but I ge the following error, when I try to configure MSSQL in accelerate and then setup the client/edge in my application:
Unknown server error: {"type":"UnknownJsonError","body":{"code":"P6000","message":"Something went wrong."}} (The request id was: 88b049569d096dc7)
Unknown server error: {"type":"UnknownJsonError","body":{"code":"P6000","message":"Something went wrong."}} (The request id was: 88b049569d096dc7)
2 replies
PPrisma
Created by jermahs on 4/12/2024 in #help-and-questions
SOLVED: Create w/ sub create: Subquery returned more than 1 value
No description
2 replies