Skip to content

bug(cli): prisma format does not format files other than schema.prisma when using prismaSchemaFolder preview feature #25136

@SetDefaultOne

Description

@SetDefaultOne

Bug description

Running the prisma format command on a directory with a schema.prisma file and a model.schema file will only cause the schema.prisma file to be formatted. The CLI allows a --schema flag to point to a schema file but doing so with the prismaSchemaFolder preview feature enabled causes it to error as the native database types found from the datasource provider in schema.prisma is not used.

image

How to reproduce

  • Create a Prisma schema folder.
  • Enable prismaSchemaFolder preview feature.
  • Run prisma format on the schema folder.
  • Run prisma format --schema=<model schema> to format a model file.

Expected behavior

This should ideally format all valid schema files when under a schema folder or at least auto detect the datasource provider.

Prisma information

schema.prisma

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["prismaSchemaFolder"]
}

datasource db {
  provider = "cockroachdb"
  url      = env("ENGINE_DATABASE_URL")
}

model.prisma

model Model {
    id String @id @db.String(12)
}

Environment & setup

  • OS: Windows
  • Database: CockroachDB
  • Node.js version: v20.17.0

Prisma Version

prisma                  : 5.19.0
@prisma/client          : 5.19.0
Computed binaryTarget   : windows
Operating System        : win32
Architecture            : x64
Node.js                 : v20.17.0
Query Engine (Node-API) : libquery-engine 5fe21811a6ba0b952a3bc71400666511fe3b902f (at ..\..\..\..\..\..\..\..\..\..\nvm\v20.17.0\node_modules\prisma\node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine           : schema-engine-cli 5fe21811a6ba0b952a3bc71400666511fe3b902f (at ..\..\..\..\..\..\..\..\..\..\nvm\v20.17.0\node_modules\prisma\node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm             : @prisma/prisma-schema-wasm 5.19.0-31.5fe21811a6ba0b952a3bc71400666511fe3b902f
Default Engines Hash    : 5fe21811a6ba0b952a3bc71400666511fe3b902f
Studio                  : 0.502.0
Preview Features        : prismaSchemaFolder

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.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