In the last part of my project I cannot seem to get the prisma database to deploy properly. The site successfully builds and I am able to view the site, but the momment I attempt to access the database it says that the following:
Invalid prisma.product.findUnique() invocation: The table main.Product does not exist in the current database.
I do have schema for it to migrate off:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
...
model Product {
id String @id@unique
quantity Int @default(0)
physical Boolean @default(false)
onhold Int @default(0)
}
...
During the build process on render.com it specifies the following:
Nov 3 02:40:16 PM import { PrismaClient } from '@prisma/client'
Nov 3 02:40:16 PM const prisma = new PrismaClient()
Nov 3 02:40:16 PM
Nov 3 02:40:19 PM Prisma schema loaded from server/database/schema.prisma
Nov 3 02:40:19 PM Datasource "db": SQLite database "dev.db" at "file:./dev.db"
Nov 3 02:40:19 PM
Nov 3 02:40:19 PM No migration found in prisma/migrations
Nov 3 02:40:19 PM
Nov 3 02:40:19 PM
Nov 3 02:40:19 PM No pending migrations to apply.
I have set up the build command as such:
npm install; prisma generate --schema=./server/database/schema.prisma; prisma migrate deploy --schema=./server/database/schema.prisma; npm run build;
At the time there was no migration directory in the latest commit
When the project is built would it include what I have configured for the migration? Is the '--schema=...' pointing to the correct directory at the point where it is built?
What I have tried: Overall I have more questions than things I have tried due to a lack of knowledge on my part.
When I look at the nuxt build files for this project, it generates a completely different file structure than when its unbuilt, when tareting the SQL db to dev.db would it possibly be pointing incorrectly?
In addition, SQL lite is not good for production? If so what alternative would be good, as well as, how would one install that db onto the deployment server?
Nov 3 02:40:19 PM Datasource "db": SQLite database "dev.db" at "file:./dev.db"
Does this line indicate that it has found the db to connect to? Overall, I am confused as to how it cannot find the Products table despite it being provided in my schema.
The overall question is what is causing the table to not be seen by the built nuxt app when querying?