Skip to content

[TRI-5172] Compatibility with Prisma 6.6+ #1926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
matt-aitken opened this issue Apr 15, 2025 · 5 comments
Open

[TRI-5172] Compatibility with Prisma 6.6+ #1926

matt-aitken opened this issue Apr 15, 2025 · 5 comments

Comments

@matt-aitken
Copy link
Member

matt-aitken commented Apr 15, 2025

In Prisma 6.6.0+ they require an output path and no longer generate the Prisma client in node_modules.

Details here.

This is going to cause problems with our official prisma extension which was built to deal with the old way.

It seems like the way to fix this would be to do this from their docs:

pass the the --schema option to your Prisma CLI command (e.g. prisma migrate dev --schema ./prisma/schema)

We don't pass the --schema for folders right now I don't think

TRI-5172

@matt-aitken matt-aitken changed the title Prisma with 6.6+ [TRI-5172] Prisma with 6.6+ Apr 15, 2025
@matt-aitken matt-aitken changed the title [TRI-5172] Prisma with 6.6+ Compatibility with Prisma 6.6+ Apr 15, 2025
@matt-aitken matt-aitken changed the title Compatibility with Prisma 6.6+ [TRI-5172] Compatibility with Prisma 6.6+ Apr 15, 2025
@mfts
Copy link

mfts commented Apr 15, 2025

Correct, you explicitly don't add the --schema flag when schemaFolder was detected

commands.push(
`${binaryForRuntime(
manifest.runtime
)} node_modules/prisma/build/index.js generate ${generatorFlags.join(" ")}` // Don't add the --schema flag or this will fail
);

i think this should fix it:

for schema folder:

commands.push(
        `${binaryForRuntime(
          manifest.runtime
        )} node_modules/prisma/build/index.js generate --schema=./prisma/schema ${generatorFlags.join(" ")}` // Add the --schema flag for prisma@^6.6.0 compatibilty
      );

for schema file

commands.push(
        `${binaryForRuntime(
          manifest.runtime
        )} node_modules/prisma/build/index.js generate --schema=./prisma/schema.prisma ${generatorFlags.join(" ")}` // Add the --schema flag for prisma@^6.6.0 compatibilty
      );

@ericallam
Copy link
Member

@mfts as a workaround for now, you can specify the path to the prisma schema in your package.json like this:

"prisma": {
    "schema": "prisma/schema"
  }

@mfts
Copy link

mfts commented Apr 17, 2025

@ericallam ok cool. I'll try that.

@ericallam
Copy link
Member

It looks like our extension is going to need some extensive updates to fully support Prisma 6.6.0:

  • Handle prisma.config.ts file if it exists, and potentially use it's values to configure the extension
  • The schema location is no longer automatically detected (see their docs on this here: https://www.prisma.io/docs/orm/prisma-schema/overview/location)
  • We need to stop inferring if the schema dir is being used by looking at the parent dir of the schema.prisma file and assuming it will be named schema

@ericallam
Copy link
Member

For anyone running into issues with 6.6.0, when using prismaSchemaFolder feature

  • Make sure your schema.prisma file is located inside prisma/schema, alongside your other .schema files.
  • Move your migrations dir into the same dir as the schema.prisma file
  • Make sure you specify the schema option in the prismaExtension call to point at the schema.prisma file
  • Specify the "schema" path that prisma generate will use in your package.json where your trigger.config.ts lives to point to prisma/schema (see my comment above)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants