Browse Source

refactor: convert alias to string and remove knew.raw wrapper

pull/9142/head
Pranav C 4 months ago
parent
commit
68522a87db
  1. 17
      packages/nocodb/src/db/BaseModelSqlv2.ts
  2. 10
      packages/nocodb/src/services/meta-diffs.service.ts

17
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -1011,10 +1011,7 @@ class BaseModelSqlv2 {
)
.from(count.as(getAlias()));
selectors.push(
this.dbDriver.raw(`(??) as "??"`, [
subQuery,
this.dbDriver.raw(f.alias),
]),
this.dbDriver.raw(`(??) as ??`, [subQuery, `${f.alias}`]),
);
break;
case 'mysql2':
@ -1391,10 +1388,7 @@ class BaseModelSqlv2 {
)
.from(tQb.as(getAlias()));
selectors.push(
this.dbDriver.raw(`(??) as "??"`, [
subQuery,
this.dbDriver.raw(f.alias),
]),
this.dbDriver.raw(`(??) as ??`, [subQuery, `${f.alias}`]),
);
break;
case 'mysql2':
@ -1597,12 +1591,7 @@ class BaseModelSqlv2 {
tQb.select(jsonBuildObject);
selectors.push(
this.dbDriver.raw(`(??) as ??`, [
tQb,
this.dbDriver.raw(`"${f.alias}"`),
]),
);
selectors.push(this.dbDriver.raw(`(??) as ??`, [tQb, `${f.alias}`]));
}
qb.select(...selectors);

10
packages/nocodb/src/services/meta-diffs.service.ts

@ -448,7 +448,10 @@ export class MetaDiffsService {
}
for (const relation of relationList) {
if (!relation?.found?.[RelationTypes.BELONGS_TO] && !relation?.found?.[RelationTypes.ONE_TO_ONE]) {
if (
!relation?.found?.[RelationTypes.BELONGS_TO] &&
!relation?.found?.[RelationTypes.ONE_TO_ONE]
) {
changes
.find((t) => t.table_name === relation.tn)
?.detectedChanges.push({
@ -462,7 +465,10 @@ export class MetaDiffsService {
cstn: relation.cstn,
});
}
if (!relation?.found?.[RelationTypes.HAS_MANY] && !relation?.found?.[RelationTypes.ONE_TO_ONE]) {
if (
!relation?.found?.[RelationTypes.HAS_MANY] &&
!relation?.found?.[RelationTypes.ONE_TO_ONE]
) {
changes
.find((t) => t.table_name === relation.rtn)
?.detectedChanges.push({

Loading…
Cancel
Save