@mikro-orm/sql 7.0.6-dev.4 → 7.0.6-dev.6
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.
|
@@ -25,7 +25,7 @@ export class BasePostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
27
|
getEnumArrayCheckConstraintExpression(column, items) {
|
|
28
|
-
return `${this.quoteIdentifier(column)} <@ array[${items.map(item =>
|
|
28
|
+
return `${this.quoteIdentifier(column)} <@ array[${items.map(item => `${this.quoteValue(item)}::text`).join(', ')}]`;
|
|
29
29
|
}
|
|
30
30
|
supportsMaterializedViews() {
|
|
31
31
|
return true;
|
|
@@ -483,19 +483,13 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
|
483
483
|
const m1 = item.definition?.match(/check \(\(\("?(\w+)"?\)::/i) || item.definition?.match(/check \(\("?(\w+)"? = /i);
|
|
484
484
|
const m2 = item.definition?.match(/\(array\[(.*)]\)/i) || item.definition?.match(/ = (.*)\)/i);
|
|
485
485
|
if (item.columnName && m1 && m2) {
|
|
486
|
-
const m3 = m2[1].match(/('[^']*'::text)/g);
|
|
487
|
-
let items;
|
|
488
486
|
/* v8 ignore next */
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
items = m2[1].split(',').map((item) => /^\(?'(.*)'/.exec(item.trim())?.[1]);
|
|
494
|
-
}
|
|
487
|
+
const parts = m2[1].match(/('(?:[^']|'')*'::\w[\w ]*)/g) ?? m2[1].split(',');
|
|
488
|
+
let items = parts.map((item) => /^\(?'((?:[^']|'')*)'/.exec(item.trim())?.[1]?.replace(/''/g, "'"));
|
|
495
489
|
items = items.filter(item => item !== undefined);
|
|
496
490
|
if (items.length > 0) {
|
|
497
491
|
o[item.columnName] = items;
|
|
498
|
-
item.expression =
|
|
492
|
+
item.expression = this.platform.getEnumCheckConstraintExpression(item.columnName, items);
|
|
499
493
|
item.definition = `check (${item.expression})`;
|
|
500
494
|
}
|
|
501
495
|
}
|
|
@@ -332,7 +332,9 @@ export class SqliteSchemaHelper extends SchemaHelper {
|
|
|
332
332
|
const match = /[`["']([^`\]"']+)[`\]"'] text check \(.* \((.*)\)/i.exec(item);
|
|
333
333
|
/* v8 ignore next */
|
|
334
334
|
if (match) {
|
|
335
|
-
o[match[1]] = match[2]
|
|
335
|
+
o[match[1]] = match[2]
|
|
336
|
+
.split(/,(?=\s*'(?:[^']|'')*'(?:\s*\)|$))/)
|
|
337
|
+
.map((item) => /^\(?'((?:[^']|'')*)'/.exec(item.trim())[1].replace(/''/g, "'"));
|
|
336
338
|
}
|
|
337
339
|
return o;
|
|
338
340
|
}, {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.0.6-dev.
|
|
3
|
+
"version": "7.0.6-dev.6",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mikro-orm/core": "^7.0.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.0.6-dev.
|
|
56
|
+
"@mikro-orm/core": "7.0.6-dev.6"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|