[SQLite] Bug in prismaSchemaFolder
: Incorrect Database File Generation and Missing Table Error #24779
Closed
Description
Bug description
When using Prisma and SQLite in NestJS and the new feature prismaSchemaFolder, with datasource db.url = "file:./dev.db". prisma db push
, a dev.db file will be generated under prisma/schema. But when the application is running, for example, when accessing an API that uses Prisma Client, a dev.db will be generated under the prisma folder, which is a blank database.an error is reported: The table main.Project
does not exist in the current database.
__
How to reproduce
- use prismaSchemaFolder
- db.url = "file:./dev.db"
- prisma db push
- access API with prismaService
Expected behavior
Use the dev.db file under prisma/schema
Prisma information
generator client {
provider = "prisma-client-js"
previewFeatures = ["prismaSchemaFolder"]
}
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
@Injectable()
export class AppService {
constructor(private prisma: PrismaService) {}
getHello() {
return this.prisma.project.create({
data: {
name: 'test',
description: 'test',
},
});
}
}
Environment & setup
- OS: Windows11
- Database: SQLite
- Node.js version: v20.15.0
Prisma Version
prisma : 5.16.2
@prisma/client : 5.16.2
Computed binaryTarget : windows
Operating System : win32
Architecture : x64
Node.js : v20.15.0
Query Engine (Node-API) : libquery-engine 34ace0eb2704183d2c05b60b52fba5c43c13f303 (at node_modules\.pnpm\@prisma+engines@5.16.2\node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine : schema-engine-cli 34ace0eb2704183d2c05b60b52fba5c43c13f303 (at node_modules\.pnpm\@prisma+engines@5.16.2\node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm : @prisma/prisma-schema-wasm 5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303
Default Engines Hash : 34ace0eb2704183d2c05b60b52fba5c43c13f303
Studio : 0.502.0
Preview Features : prismaSchemaFolder