From 0d8a88b2c89011ad07636999e630e63c9f25d2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Wed, 29 May 2024 18:16:10 +0900 Subject: [PATCH] fix(backend): __disambiguation__ --- packages/backend/src/models/_.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/models/_.ts b/packages/backend/src/models/_.ts index 72203ee945..0d60e4b17b 100644 --- a/packages/backend/src/models/_.ts +++ b/packages/backend/src/models/_.ts @@ -84,16 +84,16 @@ export const miRepository = { // @ts-expect-error -- protected const insertedColumns = queryBuilder.getInsertedColumns(); if (insertedColumns.length) { - return insertedColumns.map(column => column.databaseName); + return insertedColumns.map(column => `__disambiguation__${column.databaseName}`); } if (!queryBuilder.expressionMap.mainAlias?.hasMetadata && !queryBuilder.expressionMap.insertColumns.length) { // @ts-expect-error -- protected const valueSets = queryBuilder.getValueSets(); if (valueSets.length === 1) { - return Object.keys(valueSets[0]); + return Object.keys(valueSets[0]).map(key => `__disambiguation__${key}`); } } - return queryBuilder.expressionMap.insertColumns; + return queryBuilder.expressionMap.insertColumns.map(column => `__disambiguation__${column}`); }, async insertOne(entity, findOptions?) { const queryBuilder = this.createQueryBuilder().insert().values(entity).returning('*'); @@ -115,7 +115,7 @@ export const miRepository = { return builder.select(selection, selectionAliasName); }; for (const columnName of this.createTableColumnNames(queryBuilder)) { - selectOrAddSelect(`${builder.alias}.${columnName}`, `${builder.alias}_${columnName}`); + selectOrAddSelect(`${builder.alias}.${columnName}`, `${builder.alias}_${columnName.slice('__disambiguation__'.length)}`); } }, } satisfies MiRepository;