Skip to content

Support glob patterns in schema option for prismaSchemaFolder #26989

Open

Description

@nissy-dev

Feature Summary

Add support glob patterns in schema option for prismaSchemaFolder

Use Cases & Problem Description

We are using multiple databases based on the Prisma guide. In doing so, we want to keep the structure as modular as possible, and we would like to distinguish schemas corresponding to different databases by their file extensions, like this:

/
└─ src
   └─ modules
      ├─ module-a
      │  ├─ db
      │  │  ├─ module-a.database-1.prisma
      │  │  └─ module-a.database-2.prisma
      │  ├─ graphql
      │  │  └─ module-a.graphql
      │  └─ ...
      ├─ module-b
      │  ├─ db
      │  │  ├─ module-b.database-1.prisma
      │  │  └─ module-b.database-1.prisma
      │  ├─ graphql
      │  │  └─ module-b.graphql
      │  └─ ...
      └─ ...

Currently, the schema option in prismaSchemaFolder only accepts either a file or a directory, so this method cannot be used.

import { defineConfig } from "prisma/config";

export default defineConfig({
  earlyAccess: true,
  // It unintentionally includes both database-1.prisma and database-2.prisma.
  schema: "./src/modules",
});

Proposed Solution

I would like the schema option to support glob patterns.

import { defineConfig } from "prisma/config";

export default defineConfig({
  earlyAccess: true,
  schema: "./src/modules/**/*.database-1.prisma",
});

Alternative Solutions

There is a tool called prisma-import that allowed us to look up appropriate files using glob patterns, and we had been using it even before prismaSchemaFolder was introduced. However, since prisma-import is no longer maintained, it would be great if similar functionality could be supported in prismaSchemaFolder.

Potential Considerations

No response

Prisma Version

6.6.0

What part of Prisma does this affect?

Prisma Schema

Additional Context

I have found that the logic for fetching schemas is located here, so I believe I could also submit a PR myself if necessary: https://github.com/prisma/prisma/blob/main/packages/internals/src/cli/getSchema.ts

Pre-Submission Checklist

  • I have searched existing issues to make sure this is not a duplicate
  • I have checked the Prisma roadmap to see if this is already planned
  • I have described why this belongs in Prisma Core rather than a solution in application code

Activity

  1. added
    kind/feature
    on Apr 26, 2025
  2. Euregan commented on Nov 20, 2026

    @Euregan

    Same need here. We're on Prisma 6 with MongoDB, planning a gradual move to Postgres. Our .prisma files live next to each domain's code, so both schemas will share one source tree during the move. A folder path picks up every .prisma file, so today the only option is a copy step before generate.

    I'd like to implement this. Docs too, if that's in scope for a patch.

    I know 6 isn't on the supported versions list anymore. Would you accept this and publish it as a 6.19.x release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featuretopic: prismaSchemaFolder

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions