@mikro-orm/sql 7.1.4-dev.1 → 7.1.4-dev.11
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/AbstractSqlDriver.js
CHANGED
|
@@ -494,7 +494,7 @@ export class AbstractSqlDriver extends DatabaseDriver {
|
|
|
494
494
|
if (prop.fieldNames.every(name => typeof root[`${relationAlias}__${name}`] === 'undefined')) {
|
|
495
495
|
return;
|
|
496
496
|
}
|
|
497
|
-
if (prop.polymorphic) {
|
|
497
|
+
if (prop.polymorphic && prop.kind !== ReferenceKind.EMBEDDED) {
|
|
498
498
|
const discriminatorAlias = `${relationAlias}__${prop.fieldNames[0]}`;
|
|
499
499
|
const discriminatorValue = root[discriminatorAlias];
|
|
500
500
|
const pkFieldNames = prop.fieldNames.slice(1);
|
|
@@ -768,11 +768,11 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {
|
|
|
768
768
|
}
|
|
769
769
|
async getNativeEnumDefinitions(connection, schemas, ctx) {
|
|
770
770
|
const uniqueSchemas = Utils.unique(schemas);
|
|
771
|
-
const res = await connection.execute(`select t.typname as enum_name, n.nspname as schema_name, array_agg(e.enumlabel order by e.enumsortorder) as enum_value
|
|
771
|
+
const res = await connection.execute(`select t.typname as enum_name, n.nspname as schema_name, array_remove(array_agg(e.enumlabel order by e.enumsortorder), null) as enum_value
|
|
772
772
|
from pg_type t
|
|
773
|
-
join pg_enum e on t.oid = e.enumtypid
|
|
773
|
+
left join pg_enum e on t.oid = e.enumtypid
|
|
774
774
|
join pg_catalog.pg_namespace n on n.oid = t.typnamespace
|
|
775
|
-
where n.nspname in (${Array(uniqueSchemas.length).fill('?').join(', ')})
|
|
775
|
+
where t.typtype = 'e' and n.nspname in (${Array(uniqueSchemas.length).fill('?').join(', ')})
|
|
776
776
|
group by t.typname, n.nspname`, uniqueSchemas, 'all', ctx);
|
|
777
777
|
return res.reduce((o, row) => {
|
|
778
778
|
let name = row.enum_name;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/sql",
|
|
3
|
-
"version": "7.1.4-dev.
|
|
3
|
+
"version": "7.1.4-dev.11",
|
|
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.1.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@mikro-orm/core": "7.1.4-dev.
|
|
56
|
+
"@mikro-orm/core": "7.1.4-dev.11"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">= 22.17.0"
|
package/plugin/transformer.js
CHANGED
|
@@ -323,7 +323,7 @@ export class MikroTransformer extends OperationNodeTransformer {
|
|
|
323
323
|
}
|
|
324
324
|
const newColumns = [...node.columns];
|
|
325
325
|
for (const prop of missingProps) {
|
|
326
|
-
newColumns.push(ColumnNode.create(prop.
|
|
326
|
+
newColumns.push(ColumnNode.create(prop.fieldNames[0]));
|
|
327
327
|
}
|
|
328
328
|
const newRows = node.values.values.map(row => {
|
|
329
329
|
const valuesToAdd = missingProps.map(prop => {
|
|
@@ -366,7 +366,7 @@ export class MikroTransformer extends OperationNodeTransformer {
|
|
|
366
366
|
const newUpdates = [...node.updates];
|
|
367
367
|
for (const prop of missingProps) {
|
|
368
368
|
const val = prop.onUpdate(undefined, this.#em);
|
|
369
|
-
newUpdates.push(ColumnUpdateNode.create(ColumnNode.create(prop.
|
|
369
|
+
newUpdates.push(ColumnUpdateNode.create(ColumnNode.create(prop.fieldNames[0]), ValueNode.create(val)));
|
|
370
370
|
}
|
|
371
371
|
return {
|
|
372
372
|
...node,
|