Skip to content

Commit

Permalink
Merge pull request #1017 from undb-xyz/release/v0.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
nichenqin authored May 22, 2023
2 parents 7a23e30 + 9acf911 commit 1454867
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"chart.js": "^4.3.0",
"classnames": "^2.3.2",
"date-fns": "^2.30.0",
"delay": "^5.0.0",
"delay": "^6.0.0",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-svelte3": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "undb",
"version": "0.4.5",
"version": "0.4.6",
"devDependencies": {
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ export class RecordSqliteReferenceQueryVisitor extends AbstractReferenceFieldVis
...averageFields.map((f) => this.knex.raw(`avg(${fta}.${f.averageAggregateField.id}) as ${f.id}`)),
)
.from(closure.name)
.groupBy(ClosureTable.PARENT_ID, ClosureTable.CHILD_ID)
.where(ClosureTable.DEPTH, 1)
.groupBy(ClosureTable.PARENT_ID)
.as(uta)

const nestSubQuery = knex
Expand All @@ -359,12 +360,7 @@ export class RecordSqliteReferenceQueryVisitor extends AbstractReferenceFieldVis
(c) => `${uta}.${c.id.value} as ${c.id.value}`,
),
)
.leftJoin(subQuery, function () {
this.on(`${TABLE_ALIAS}.${INTERNAL_COLUMN_ID_NAME}`, `${uta}.${ClosureTable.PARENT_ID}`).andOn(
`${uta}.${ClosureTable.DEPTH}`,
knex.raw('?', [1]),
)
})
.leftJoin(subQuery, `${TABLE_ALIAS}.${INTERNAL_COLUMN_ID_NAME}`, `${uta}.${ClosureTable.PARENT_ID}`)
}
parent(field: CoreParentField): void {
if (this.#visited.has(field.id.value)) {
Expand All @@ -389,7 +385,8 @@ export class RecordSqliteReferenceQueryVisitor extends AbstractReferenceFieldVis
...displayColumns.map((f) => knex.raw(`json_array(${fta}.${f.id.value}) as ${f.id.value}`)),
)
.from(closure.name)
.groupBy(ClosureTable.CHILD_ID, ClosureTable.PARENT_ID)
.where(ClosureTable.DEPTH, 1)
.groupBy(ClosureTable.CHILD_ID)
.as(uta)

const nestSubQuery = knex
Expand All @@ -411,12 +408,7 @@ export class RecordSqliteReferenceQueryVisitor extends AbstractReferenceFieldVis
this.#getFieldExpand(uta, column),
...lookupFields.map((c) => this.#getFieldExpand(uta, c)),
)
.leftJoin(subQuery, function () {
this.on(`${uta}.${ClosureTable.CHILD_ID}`, `${TABLE_ALIAS}.${INTERNAL_COLUMN_ID_NAME}`).andOn(
`${uta}.${ClosureTable.DEPTH}`,
knex.raw('?', [1]),
)
})
.leftJoin(subQuery, `${uta}.${ClosureTable.CHILD_ID}`, `${TABLE_ALIAS}.${INTERNAL_COLUMN_ID_NAME}`)

this.#visited.add(field.id.value)
}
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1454867

Please sign in to comment.