Hello,
I am showing the output of this migration command just to ensure that my database and schema are properly synced.
PS E:\Work> npx prisma migrate dev
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": MySQL database "test-db" at "localhost:3306"
Already in sync, no schema change or pending migration was found.
✔️ Generated Prisma Client (3.2.1) to .\node_modules\@prisma\client in 896ms
The actual issue is addressed here:
I recently added a field price Int? in my offers table.
I have attached the migration.sql screenshot.
I have attached the screenshot of Prisma studio as well in which it is showing the price field in the fields list.
I have also attached the screenshot of the postman request. (You can clearly see the error it is throwing in response)
But the issue is when I try to fetch an offer it throws an error message :
"\nInvalid
prisma.offer.findFirst()
invocation:\n\n\n Failed to validate the query:
Field does not exist on enclosing type.
at `Query.findFirstoffer.offer.price`",
My query to fetch offer:
const offer = await prisma.offer.findFirst({
where: {
id: Number(req.params.id),
is_active: true,
}
})
Unable to figure out why it is not considering price as a field in the offer table and throwing Field does not exist on enclosing type.
(Struggling with this for the last two days and still didn't found a solution out there)
@Ryan Please guide me.
Thanking you in advance :)