@prisma/adapter-pg 7.10.0-dev.43 → 7.10.0-dev.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -5
- package/dist/index.mjs +11 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -470,18 +470,24 @@ function mapDriverError(error) {
|
|
|
470
470
|
message: error.message
|
|
471
471
|
};
|
|
472
472
|
case "23505": {
|
|
473
|
+
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
473
474
|
let constraint;
|
|
474
475
|
if (error.constraint) {
|
|
475
476
|
constraint = { index: error.constraint };
|
|
476
|
-
} else {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
477
|
+
} else if (fields !== void 0) {
|
|
478
|
+
constraint = { fields };
|
|
479
|
+
}
|
|
480
|
+
let table = error.table;
|
|
481
|
+
if (table === void 0 && fields !== void 0 && fields.length > 0) {
|
|
482
|
+
const suffix = `_${fields.join("_")}_key`;
|
|
483
|
+
if (error.constraint?.endsWith(suffix)) {
|
|
484
|
+
table = error.constraint.slice(0, -suffix.length);
|
|
480
485
|
}
|
|
481
486
|
}
|
|
482
487
|
return {
|
|
483
488
|
kind: "UniqueConstraintViolation",
|
|
484
|
-
constraint
|
|
489
|
+
constraint,
|
|
490
|
+
table
|
|
485
491
|
};
|
|
486
492
|
}
|
|
487
493
|
case "23502": {
|
package/dist/index.mjs
CHANGED
|
@@ -434,18 +434,24 @@ function mapDriverError(error) {
|
|
|
434
434
|
message: error.message
|
|
435
435
|
};
|
|
436
436
|
case "23505": {
|
|
437
|
+
const fields = error.detail?.match(/Key \(([^)]+)\)/)?.at(1)?.split(", ");
|
|
437
438
|
let constraint;
|
|
438
439
|
if (error.constraint) {
|
|
439
440
|
constraint = { index: error.constraint };
|
|
440
|
-
} else {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
} else if (fields !== void 0) {
|
|
442
|
+
constraint = { fields };
|
|
443
|
+
}
|
|
444
|
+
let table = error.table;
|
|
445
|
+
if (table === void 0 && fields !== void 0 && fields.length > 0) {
|
|
446
|
+
const suffix = `_${fields.join("_")}_key`;
|
|
447
|
+
if (error.constraint?.endsWith(suffix)) {
|
|
448
|
+
table = error.constraint.slice(0, -suffix.length);
|
|
444
449
|
}
|
|
445
450
|
}
|
|
446
451
|
return {
|
|
447
452
|
kind: "UniqueConstraintViolation",
|
|
448
|
-
constraint
|
|
453
|
+
constraint,
|
|
454
|
+
table
|
|
449
455
|
};
|
|
450
456
|
}
|
|
451
457
|
case "23502": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-pg",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.44",
|
|
4
4
|
"description": "Prisma's driver adapter for \"pg\"",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"pg": "^8.16.3",
|
|
35
35
|
"postgres-array": "3.0.4",
|
|
36
36
|
"@types/pg": "^8.16.0",
|
|
37
|
-
"@prisma/driver-adapter-utils": "7.10.0-dev.
|
|
37
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.44"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@prisma/debug": "7.10.0-dev.
|
|
40
|
+
"@prisma/debug": "7.10.0-dev.44"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "DEV=true tsx helpers/build.ts",
|