@prisma/adapter-better-sqlite3 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 +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -443,10 +443,13 @@ function mapDriverError(error) {
|
|
|
443
443
|
switch (error.code) {
|
|
444
444
|
case "SQLITE_CONSTRAINT_UNIQUE":
|
|
445
445
|
case "SQLITE_CONSTRAINT_PRIMARYKEY": {
|
|
446
|
-
const
|
|
446
|
+
const columns = error.message.split("constraint failed: ").at(1)?.split(", ");
|
|
447
|
+
const fields = columns?.map((field) => field.split(".").pop());
|
|
448
|
+
const table = columns?.at(0)?.split(".").slice(0, -1).join(".") || void 0;
|
|
447
449
|
return {
|
|
448
450
|
kind: "UniqueConstraintViolation",
|
|
449
|
-
constraint: fields !== void 0 ? { fields } : void 0
|
|
451
|
+
constraint: fields !== void 0 ? { fields } : void 0,
|
|
452
|
+
table
|
|
450
453
|
};
|
|
451
454
|
}
|
|
452
455
|
case "SQLITE_CONSTRAINT_NOTNULL": {
|
package/dist/index.mjs
CHANGED
|
@@ -407,10 +407,13 @@ function mapDriverError(error) {
|
|
|
407
407
|
switch (error.code) {
|
|
408
408
|
case "SQLITE_CONSTRAINT_UNIQUE":
|
|
409
409
|
case "SQLITE_CONSTRAINT_PRIMARYKEY": {
|
|
410
|
-
const
|
|
410
|
+
const columns = error.message.split("constraint failed: ").at(1)?.split(", ");
|
|
411
|
+
const fields = columns?.map((field) => field.split(".").pop());
|
|
412
|
+
const table = columns?.at(0)?.split(".").slice(0, -1).join(".") || void 0;
|
|
411
413
|
return {
|
|
412
414
|
kind: "UniqueConstraintViolation",
|
|
413
|
-
constraint: fields !== void 0 ? { fields } : void 0
|
|
415
|
+
constraint: fields !== void 0 ? { fields } : void 0,
|
|
416
|
+
table
|
|
414
417
|
};
|
|
415
418
|
}
|
|
416
419
|
case "SQLITE_CONSTRAINT_NOTNULL": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-better-sqlite3",
|
|
3
|
-
"version": "7.10.0-dev.
|
|
3
|
+
"version": "7.10.0-dev.44",
|
|
4
4
|
"description": "Prisma's driver adapter for better-sqlite3, a fast SQLite3 driver for JavaScript runtimes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"better-sqlite3": "^12.6.0",
|
|
35
|
-
"@prisma/driver-adapter-utils": "7.10.0-dev.
|
|
35
|
+
"@prisma/driver-adapter-utils": "7.10.0-dev.44"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/better-sqlite3": "7.6.12",
|