Skip to content

Commit

Permalink
make table optional in UpdateQueryNode.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Sep 22, 2023
1 parent fbddc99 commit 0fcb705
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/operation-node/update-query-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type UpdateValuesNode = ValueListNode | PrimitiveValueListNode

export interface UpdateQueryNode extends OperationNode {
readonly kind: 'UpdateQueryNode'
readonly table: OperationNode
readonly table?: OperationNode
readonly from?: FromNode
readonly joins?: ReadonlyArray<JoinNode>
readonly where?: WhereNode
Expand Down
9 changes: 7 additions & 2 deletions src/query-compiler/default-query-compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,13 @@ export class DefaultQueryCompiler
}

this.append('update ')
this.visitNode(node.table)
this.append(' set ')

if (node.table) {
this.visitNode(node.table)
this.append(' ')
}

this.append('set ')

if (node.updates) {
this.compileList(node.updates)
Expand Down

0 comments on commit 0fcb705

Please sign in to comment.