@mikro-orm/postgresql 7.0.0-dev.76 → 7.0.0-dev.78
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.
|
@@ -11,7 +11,7 @@ export class PostgreSqlExceptionConverter extends ExceptionConverter {
|
|
|
11
11
|
if (exception.hint?.toString().trim()) {
|
|
12
12
|
exception.message += '\n - hint: ' + exception.hint;
|
|
13
13
|
}
|
|
14
|
-
/* v8 ignore
|
|
14
|
+
/* v8 ignore next */
|
|
15
15
|
switch (exception.code) {
|
|
16
16
|
case '40001':
|
|
17
17
|
case '40P01':
|
|
@@ -42,7 +42,6 @@ export class PostgreSqlExceptionConverter extends ExceptionConverter {
|
|
|
42
42
|
case '42P07':
|
|
43
43
|
return new TableExistsException(exception);
|
|
44
44
|
}
|
|
45
|
-
/* v8 ignore stop */
|
|
46
45
|
return super.convertException(exception);
|
|
47
46
|
}
|
|
48
47
|
}
|
package/PostgreSqlPlatform.js
CHANGED
|
@@ -62,7 +62,7 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
62
62
|
return 'int';
|
|
63
63
|
}
|
|
64
64
|
getBigIntTypeDeclarationSQL(column) {
|
|
65
|
-
/* v8 ignore next
|
|
65
|
+
/* v8 ignore next */
|
|
66
66
|
if (column.autoincrement) {
|
|
67
67
|
return `bigserial`;
|
|
68
68
|
}
|
|
@@ -78,7 +78,7 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
78
78
|
if (prop.customType instanceof FullTextType) {
|
|
79
79
|
return `:column: @@ plainto_tsquery('${prop.customType.regconfig}', :query)`;
|
|
80
80
|
}
|
|
81
|
-
/* v8 ignore next
|
|
81
|
+
/* v8 ignore next */
|
|
82
82
|
if (prop.columnTypes[0] === 'tsvector') {
|
|
83
83
|
return `:column: @@ plainto_tsquery('simple', :query)`;
|
|
84
84
|
}
|
|
@@ -132,13 +132,13 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
getRegExpOperator(val, flags) {
|
|
135
|
-
/* v8 ignore next
|
|
135
|
+
/* v8 ignore next */
|
|
136
136
|
if ((val instanceof RegExp && val.flags.includes('i')) || flags?.includes('i')) {
|
|
137
137
|
return '~*';
|
|
138
138
|
}
|
|
139
139
|
return '~';
|
|
140
140
|
}
|
|
141
|
-
/* v8 ignore next
|
|
141
|
+
/* v8 ignore next */
|
|
142
142
|
getRegExpValue(val) {
|
|
143
143
|
if (val.flags.includes('i')) {
|
|
144
144
|
return { $re: val.source, $flags: val.flags };
|
|
@@ -158,7 +158,7 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
158
158
|
return 'double precision';
|
|
159
159
|
}
|
|
160
160
|
getEnumTypeDeclarationSQL(column) {
|
|
161
|
-
/* v8 ignore next
|
|
161
|
+
/* v8 ignore next */
|
|
162
162
|
if (column.nativeEnumName) {
|
|
163
163
|
return column.nativeEnumName;
|
|
164
164
|
}
|
|
@@ -286,14 +286,14 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
286
286
|
let offset = -date.getTimezoneOffset();
|
|
287
287
|
let year = date.getFullYear();
|
|
288
288
|
const isBCYear = year < 1;
|
|
289
|
-
/* v8 ignore next
|
|
289
|
+
/* v8 ignore next */
|
|
290
290
|
if (isBCYear) {
|
|
291
291
|
year = Math.abs(year) + 1;
|
|
292
292
|
}
|
|
293
293
|
const datePart = `${this.pad(year, 4)}-${this.pad(date.getMonth() + 1, 2)}-${this.pad(date.getDate(), 2)}`;
|
|
294
294
|
const timePart = `${this.pad(date.getHours(), 2)}:${this.pad(date.getMinutes(), 2)}:${this.pad(date.getSeconds(), 2)}.${this.pad(date.getMilliseconds(), 3)}`;
|
|
295
295
|
let ret = `${datePart}T${timePart}`;
|
|
296
|
-
/* v8 ignore next
|
|
296
|
+
/* v8 ignore next */
|
|
297
297
|
if (offset < 0) {
|
|
298
298
|
ret += '-';
|
|
299
299
|
offset *= -1;
|
|
@@ -302,7 +302,7 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
302
302
|
ret += '+';
|
|
303
303
|
}
|
|
304
304
|
ret += this.pad(Math.floor(offset / 60), 2) + ':' + this.pad(offset % 60, 2);
|
|
305
|
-
/* v8 ignore next
|
|
305
|
+
/* v8 ignore next */
|
|
306
306
|
if (isBCYear) {
|
|
307
307
|
ret += ' BC';
|
|
308
308
|
}
|
|
@@ -380,13 +380,13 @@ export class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
380
380
|
if (typeof value === 'string' && value.charAt(10) === 'T') {
|
|
381
381
|
return new Date(value);
|
|
382
382
|
}
|
|
383
|
-
/* v8 ignore next
|
|
383
|
+
/* v8 ignore next */
|
|
384
384
|
if (typeof value === 'number') {
|
|
385
385
|
return new Date(value);
|
|
386
386
|
}
|
|
387
387
|
// @ts-ignore fix wrong type resolution during build
|
|
388
388
|
const parsed = parseDate(value);
|
|
389
|
-
/* v8 ignore next
|
|
389
|
+
/* v8 ignore next */
|
|
390
390
|
if (parsed === null) {
|
|
391
391
|
return value;
|
|
392
392
|
}
|
|
@@ -213,7 +213,7 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
|
213
213
|
if (match) {
|
|
214
214
|
return match[1];
|
|
215
215
|
}
|
|
216
|
-
/* v8 ignore next
|
|
216
|
+
/* v8 ignore next */
|
|
217
217
|
switch (value) {
|
|
218
218
|
case 'r': return 'RESTRICT';
|
|
219
219
|
case 'c': return 'CASCADE';
|
|
@@ -305,7 +305,7 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
|
305
305
|
if (item.columnName && m1 && m2) {
|
|
306
306
|
const m3 = m2[1].match(/('[^']*'::text)/g);
|
|
307
307
|
let items;
|
|
308
|
-
/* v8 ignore next
|
|
308
|
+
/* v8 ignore next */
|
|
309
309
|
if (m3) {
|
|
310
310
|
items = m3.map((item) => item.trim().match(/^\(?'(.*)'/)?.[1]);
|
|
311
311
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/postgresql",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0.0-dev.
|
|
4
|
+
"version": "7.0.0-dev.78",
|
|
5
5
|
"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.",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./package.json": "./package.json",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@mikro-orm/knex": "7.0.0-dev.
|
|
53
|
+
"@mikro-orm/knex": "7.0.0-dev.78",
|
|
54
54
|
"pg": "8.16.3",
|
|
55
55
|
"pg-cursor": "2.15.3",
|
|
56
56
|
"postgres-array": "3.0.4",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"kysely": "0.28.8"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@mikro-orm/core": "7.0.0-dev.
|
|
65
|
+
"@mikro-orm/core": "7.0.0-dev.78",
|
|
66
66
|
"kysely": "*"
|
|
67
67
|
}
|
|
68
68
|
}
|