Skip to content
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

fix(quaint): extract constraint name from CockroachDB foreign key constraint violation error #5002

Merged
merged 15 commits into from
Sep 23, 2024

Conversation

jkomyno
Copy link
Contributor

@jkomyno jkomyno commented Sep 23, 2024

This PR fixes prisma/prisma#24072.

This PR also:

  • unifies the version of regex crate used across our internal crates
  • introduces a new macro assert_connector_error!, which conditionally expects a given error message depending on the connector available at runtime. This was introduced to assert that foreign keys aren't (not available) anymore on CockroachDB, while at the same time describing how they are extracted from other connectors' error messages.

Example usage of assert_connector_error!:

let runner: Runner = // ...

assert_connector_error!(
  &runner,
  "mutation { deleteOneParent(where: { id: 1 }) { id }}",
  2003,
  CockroachDb(_) | Postgres(_) | SqlServer(_) | Vitess(_) => "Foreign key constraint violated: `Child_parent_id_fkey (index)`",
  MySql(_) => "Foreign key constraint violated: `parent_id`",
  Sqlite(_) => "Foreign key constraint violated: `foreign key`",
  _ => "Foreign key constraint violated"
);

@jkomyno jkomyno requested a review from a team as a code owner September 23, 2024 10:27
@jkomyno jkomyno requested review from laplab and removed request for a team September 23, 2024 10:27
@jkomyno jkomyno self-assigned this Sep 23, 2024
Copy link
Contributor

github-actions bot commented Sep 23, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.708MiB 2.064MiB 659.238KiB
Postgres (gzip) 1.036MiB 824.429KiB 236.376KiB
Mysql 2.035MiB 2.034MiB 755.000B
Mysql (gzip) 812.540KiB 811.573KiB 990.000B
Sqlite 1.928MiB 1.925MiB 2.703KiB
Sqlite (gzip) 770.433KiB 769.258KiB 1.175KiB

Copy link

codspeed-hq bot commented Sep 23, 2024

CodSpeed Performance Report

Merging #5002 will not alter performance

Comparing fix/cockroachdb-fk-name (0485126) with main (c9ff577)

Summary

✅ 11 untouched benchmarks

@jkomyno jkomyno added this to the 5.20.0 milestone Sep 23, 2024
@jkomyno jkomyno merged commit 06fc58a into main Sep 23, 2024
344 of 369 checks passed
@jkomyno jkomyno deleted the fix/cockroachdb-fk-name branch September 23, 2024 17:48
jkomyno added a commit to prisma/prisma that referenced this pull request Sep 24, 2024
jkomyno added a commit to prisma/prisma that referenced this pull request Sep 24, 2024
…d445d208c284 (#25266)

* chore(deps): update engines to 5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284

* tests(client): fix tests after prisma/prisma-engines#5002

* tests(client): fix snapshots

* tests(client): fix snapshots

---------

Co-authored-by: jkomyno <[email protected]>
Co-authored-by: Alberto Schiabel <[email protected]>
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.

Prisma incorrectly parses CRDB's FK constraint error as not available
2 participants