Skip to content

Prisma 6 compatibility, with working tests (help required) #478

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

RubenNL
Copy link

@RubenNL RubenNL commented Feb 8, 2025

Changes

  • Added support for Prisma 6
  • Removed support for Prisma 5
  • New API: createManyAndReturn (this was already in 5.14.0, but the snapshots didn't have them yet)
  • Ordering of array_starts_with, array_ends_with and array_contains changed somewhere, so the snapshots have been updated. Not a functional change.
  • New field: limit on DeleteMany and UpdateMany.

Workflow

This is how i approached this PR:

  1. Update prisma in package.json, and ran the tests.
  2. Tests gave typescript errors about the FieldType, which I resolved in /src/generator/dmmf/types.ts.
  3. Everywhere where createManyAndReturn was mentioned, I also added updateManyAndReturn.
  4. 2 snapshot tests where detected as "obsolete" (20 is just because it skipped after the first was errored) because files wheren't the correct name. For one, just the file name needed to be updated, but the second one required me to add ScalarRelationFilter to src/generator/helpers.ts. I'm not sure about this last change.
  5. Updated the snapshots using u after running all the tests.

A bit harder where the integration tests. For those a working Postgres database is required:

  1. Launch a DB using sudo docker run --rm --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=testing -d -p 5432:5432 postgres
  2. Create a .env file with TEST_DATABASE_URL=postgresql://postgres:mysecretpassword@localhost:5432/testing.
  3. Run the tests with npm run test:integration
  4. Updated all the snapshots using u. The changes is the same as mentioned above.

Test results

Because I can't run tests on this repo, I also created a MR on my own repo to test my changes: RubenNL#1.

Help required

Most/all *ModelRelationFilter have been renamed to *ModelScalarRelationFilter. I can't figure out why, or how to undo this change.
Related: I had to add ScalarRelation to src/generator/helpers.ts, because otherwise the "renamed" tests failed.

@RubenNL RubenNL changed the title Prisma 6 compatibility, with working tests. Prisma 6 compatibility, with working tests (help required) Feb 8, 2025
@MichalLytek MichalLytek self-requested a review February 8, 2025 18:51
@ramiel ramiel mentioned this pull request Apr 30, 2025
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

Successfully merging this pull request may close these issues.

1 participant