From ccc1ca46ed5ec26426472935c188f546257a8a4c Mon Sep 17 00:00:00 2001 From: Harminder virk Date: Wed, 3 Jun 2020 21:02:39 +0530 Subject: [PATCH] fix: transform query aliases to lowercase, since postgresql converts them to lowercase --- src/Orm/Relations/HasMany/QueryBuilder.ts | 4 ++-- src/Orm/Relations/HasManyThrough/QueryBuilder.ts | 4 ++-- src/Orm/Relations/ManyToMany/QueryBuilder.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Orm/Relations/HasMany/QueryBuilder.ts b/src/Orm/Relations/HasMany/QueryBuilder.ts index 56f7c42f..c0cafdf0 100644 --- a/src/Orm/Relations/HasMany/QueryBuilder.ts +++ b/src/Orm/Relations/HasMany/QueryBuilder.ts @@ -126,7 +126,7 @@ export class HasManyQueryBuilder extends BaseQueryBuilder implements HasManyQuer direction: 'desc', } - const rowName = 'ADONIS_GROUP_LIMIT_COUNTER' + const rowName = 'adonis_group_limit_counter' const partitionBy = `PARTITION BY ${this.relation.foreignKeyColumName}` const orderBy = `ORDER BY ${column} ${direction}` @@ -139,7 +139,7 @@ export class HasManyQueryBuilder extends BaseQueryBuilder implements HasManyQuer this .select(this.client.raw(`row_number() over (${partitionBy} ${orderBy}) as ${rowName}`)) - .as('ADONIS_TEMP') + .as('adonis_temp') return this.relation .relatedModel() diff --git a/src/Orm/Relations/HasManyThrough/QueryBuilder.ts b/src/Orm/Relations/HasManyThrough/QueryBuilder.ts index 11b24e88..c2d5e72a 100644 --- a/src/Orm/Relations/HasManyThrough/QueryBuilder.ts +++ b/src/Orm/Relations/HasManyThrough/QueryBuilder.ts @@ -241,7 +241,7 @@ export class HasManyThroughQueryBuilder extends BaseQueryBuilder implements HasM direction: 'desc', } - const rowName = 'ADONIS_GROUP_LIMIT_COUNTER' + const rowName = 'adonis_group_limit_counter' const partitionBy = `PARTITION BY ${this.prefixThroughTable(this.relation.foreignKeyColumnName)}` const orderBy = `ORDER BY ${column} ${direction}` @@ -254,7 +254,7 @@ export class HasManyThroughQueryBuilder extends BaseQueryBuilder implements HasM this .select(this.client.raw(`row_number() over (${partitionBy} ${orderBy}) as ${rowName}`)) - .as('ADONIS_TEMP') + .as('adonis_temp') return this.relation .relatedModel() diff --git a/src/Orm/Relations/ManyToMany/QueryBuilder.ts b/src/Orm/Relations/ManyToMany/QueryBuilder.ts index 16b0b870..24e514e3 100644 --- a/src/Orm/Relations/ManyToMany/QueryBuilder.ts +++ b/src/Orm/Relations/ManyToMany/QueryBuilder.ts @@ -416,7 +416,7 @@ export class ManyToManyQueryBuilder extends BaseQueryBuilder implements ManyToMa direction: 'desc', } - const rowName = 'ADONIS_GROUP_LIMIT_COUNTER' + const rowName = 'adonis_group_limit_counter' const partitionBy = `PARTITION BY ${this.prefixPivotTable(this.relation.pivotForeignKey)}` const orderBy = `ORDER BY ${column} ${direction}` @@ -429,7 +429,7 @@ export class ManyToManyQueryBuilder extends BaseQueryBuilder implements ManyToMa this .select(this.client.raw(`row_number() over (${partitionBy} ${orderBy}) as ${rowName}`)) - .as('ADONIS_TEMP') + .as('adonis_temp') return this.relation .relatedModel()