jermahs
jermahs
PPrisma
Created by jermahs on 3/18/2025 in #help-and-questions
Migration Modified After Applied (but checksums are the same)
I have not ad any issues with my procedures yet, but today when I went to modify my chema and generate a new migration, I got the following
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQL Server database

- The migration `20241016154659_feature_flags_uq_fk` was modified after it was applied.
- The migration `20241024155043_fk_survey_request_resends` was modified after it was applied.

We need to reset the database schema

You may use prisma migrate reset to drop the development database.
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": SQL Server database

- The migration `20241016154659_feature_flags_uq_fk` was modified after it was applied.
- The migration `20241024155043_fk_survey_request_resends` was modified after it was applied.

We need to reset the database schema

You may use prisma migrate reset to drop the development database.
However, these are migrations that have been run a long time ago. I verified the checksum of my migration.sql files and the value stored in the db. They are the same. How do I get past this?
14 replies
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