Skip to content

Commit

Permalink
fix: transform query aliases to lowercase, since postgresql converts …
Browse files Browse the repository at this point in the history
…them to lowercase
  • Loading branch information
thetutlage committed Jun 3, 2020
1 parent ecfb1c6 commit ccc1ca4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Orm/Relations/HasMany/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/Orm/Relations/HasManyThrough/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/Orm/Relations/ManyToMany/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand All @@ -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()
Expand Down

0 comments on commit ccc1ca4

Please sign in to comment.