@mikro-orm/postgresql 6.2.10-dev.65 → 6.2.10-dev.67
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/PostgreSqlPlatform.d.ts
CHANGED
|
@@ -55,6 +55,9 @@ export declare class PostgreSqlPlatform extends AbstractSqlPlatform {
|
|
|
55
55
|
supportsMultipleStatements(): boolean;
|
|
56
56
|
marshallArray(values: string[]): string;
|
|
57
57
|
unmarshallArray(value: string): string[];
|
|
58
|
+
getVarcharTypeDeclarationSQL(column: {
|
|
59
|
+
length?: number;
|
|
60
|
+
}): string;
|
|
58
61
|
getBlobDeclarationSQL(): string;
|
|
59
62
|
getJsonDeclarationSQL(): string;
|
|
60
63
|
getSearchJsonPropertyKey(path: string[], type: string | undefined | Type, aliased: boolean, value?: unknown): string;
|
package/PostgreSqlPlatform.js
CHANGED
|
@@ -148,6 +148,12 @@ class PostgreSqlPlatform extends knex_1.AbstractSqlPlatform {
|
|
|
148
148
|
/* istanbul ignore next */
|
|
149
149
|
return value.substring(1, value.length - 1).split(',').map(v => v === `""` ? '' : v);
|
|
150
150
|
}
|
|
151
|
+
getVarcharTypeDeclarationSQL(column) {
|
|
152
|
+
if (column.length === -1) {
|
|
153
|
+
return 'varchar';
|
|
154
|
+
}
|
|
155
|
+
return super.getVarcharTypeDeclarationSQL(column);
|
|
156
|
+
}
|
|
151
157
|
getBlobDeclarationSQL() {
|
|
152
158
|
return 'bytea';
|
|
153
159
|
}
|
|
@@ -51,4 +51,5 @@ export declare class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
|
51
51
|
getChecks(connection: AbstractSqlConnection, tableName: string, schemaName: string, columns?: Column[]): Promise<CheckDef[]>;
|
|
52
52
|
getColumns(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<Column[]>;
|
|
53
53
|
getIndexes(connection: AbstractSqlConnection, tableName: string, schemaName?: string): Promise<IndexDef[]>;
|
|
54
|
+
inferLengthFromColumnType(type: string): number | undefined;
|
|
54
55
|
}
|
|
@@ -135,11 +135,12 @@ class PostgreSqlSchemaHelper extends knex_1.SchemaHelper {
|
|
|
135
135
|
if (type === 'numeric' && col.numeric_precision != null && col.numeric_scale != null) {
|
|
136
136
|
type += `(${col.numeric_precision},${col.numeric_scale})`;
|
|
137
137
|
}
|
|
138
|
+
const length = this.inferLengthFromColumnType(type) === -1 ? -1 : col.length;
|
|
138
139
|
const column = {
|
|
139
140
|
name: col.column_name,
|
|
140
141
|
type,
|
|
141
142
|
mappedType,
|
|
142
|
-
length
|
|
143
|
+
length,
|
|
143
144
|
precision: col.numeric_precision,
|
|
144
145
|
scale: col.numeric_scale,
|
|
145
146
|
nullable: col.is_nullable === 'YES',
|
|
@@ -500,5 +501,15 @@ class PostgreSqlSchemaHelper extends knex_1.SchemaHelper {
|
|
|
500
501
|
const res = await this.getAllIndexes(connection, [{ table_name: tableName, schema_name: schemaName }]);
|
|
501
502
|
return res[tableName];
|
|
502
503
|
}
|
|
504
|
+
inferLengthFromColumnType(type) {
|
|
505
|
+
const match = type.match(/^(varchar|character varying)\s*(?:\(\s*(\d+)\s*\))?/);
|
|
506
|
+
if (!match) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (!match[2]) {
|
|
510
|
+
return -1;
|
|
511
|
+
}
|
|
512
|
+
return +match[2];
|
|
513
|
+
}
|
|
503
514
|
}
|
|
504
515
|
exports.PostgreSqlSchemaHelper = PostgreSqlSchemaHelper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/postgresql",
|
|
3
|
-
"version": "6.2.10-dev.
|
|
3
|
+
"version": "6.2.10-dev.67",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "6.2.10-dev.
|
|
61
|
+
"@mikro-orm/knex": "6.2.10-dev.67",
|
|
62
62
|
"pg": "8.12.0",
|
|
63
63
|
"postgres-array": "3.0.2",
|
|
64
64
|
"postgres-date": "2.1.0",
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"@mikro-orm/core": "^6.2.9"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@mikro-orm/core": "6.2.10-dev.
|
|
71
|
+
"@mikro-orm/core": "6.2.10-dev.67"
|
|
72
72
|
}
|
|
73
73
|
}
|