Skip to content

[SQLite] Bug in prismaSchemaFolder: Incorrect Database File Generation and Missing Table Error #24779

Closed
@Typeve

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.
image
image

__

How to reproduce

  1. use prismaSchemaFolder
  2. db.url = "file:./dev.db"
  3. prisma db push
  4. 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

Metadata

Assignees

Labels

bug/2-confirmedBug has been reproduced and confirmed.domain/clientIssue in the "Client" domain: Prisma Client, Prisma Studio etc.kind/bugA reported bug.topic: prismaSchemaFolderMulti-File Prisma Schema

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions