Skip to content

Commit

Permalink
fix(ModelQueryBuilder): fix get deletedAt column
Browse files Browse the repository at this point in the history
  • Loading branch information
LookinGit committed Jun 2, 2022
1 parent 992eaad commit deb839e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Bindings/ModelQueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function extendModelQueryBuilder (builder: DatabaseContract['ModelQueryBu
builder.macro('restore', async function () {
ensureModelWithSoftDeletes(this.model)

const deletedAtColumn = this.model.query.$getColumn('deletedAt')?.columnName
const deletedAtColumn = this.model.$getColumn('deletedAt')?.columnName
await this.update({ [deletedAtColumn]: null })
})

Expand All @@ -39,7 +39,7 @@ export function extendModelQueryBuilder (builder: DatabaseContract['ModelQueryBu
builder.macro('onlyTrashed', function () {
ensureModelWithSoftDeletes(this.model)

const deletedAtColumn = this.model.query.$getColumn('deletedAt')?.columnName
const deletedAtColumn = this.model.$getColumn('deletedAt')?.columnName
return this.model.disableIgnore(this).whereNotNull(`${this.model.table}.${deletedAtColumn}`)
})
}

0 comments on commit deb839e

Please sign in to comment.