From deb839eb9ee3b4614695e700f67c2a9970827bd1 Mon Sep 17 00:00:00 2001 From: LookinGit Date: Thu, 2 Jun 2022 23:38:53 +0500 Subject: [PATCH] fix(ModelQueryBuilder): fix get deletedAt column --- src/Bindings/ModelQueryBuilder.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bindings/ModelQueryBuilder.ts b/src/Bindings/ModelQueryBuilder.ts index de8b9ca..9663a67 100644 --- a/src/Bindings/ModelQueryBuilder.ts +++ b/src/Bindings/ModelQueryBuilder.ts @@ -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 }) }) @@ -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}`) }) }