Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

refactor: update transaction type references to use Knex.Transaction

Pranav Cfad0934eee0d
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts
index abb0a43726..4df2e20435 100644
--- a/packages/nocodb/src/db/BaseModelSqlv2.ts
+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts
@@ -34,7 +34,6 @@ import {
UITypes,
} from 'nocodb-sdk';
import { v4 as uuidv4 } from 'uuid';
-import type { Transaction } from 'knex';
import type { Knex } from 'knex';
import type {
BulkAuditV1OperationTypes,
@@ -161,7 +160,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {
/** The base database driver (always non-transactional) */
protected _dbDriver: XKnex;
/** Optional transaction instance - when set, operations use this instead of _dbDriver */
- protected _activeTransaction?: XKnex | Transaction;
+ protected _activeTransaction?: XKnex | Knex.Transaction;
protected _viewId: string;
public get viewId() {
return this._viewId;
diff --git a/packages/nocodb/src/db/IBaseModelSqlV2.ts b/packages/nocodb/src/db/IBaseModelSqlV2.ts
index 6005493875..f015139654 100644
--- a/packages/nocodb/src/db/IBaseModelSqlV2.ts
+++ b/packages/nocodb/src/db/IBaseModelSqlV2.ts
@@ -1,5 +1,5 @@
-import type { Transaction } from 'knex';
import type BigNumber from 'bignumber.js';
+import type { Knex } from 'knex';
import type {
XcFilter,
XcFilterWithAlias,
@@ -362,7 +362,7 @@ export interface IBaseModelSqlV2 {
get viewId(): string;
/** Returns the active database driver (transaction if active, otherwise base driver) */
- get dbDriver(): CustomKnex | Transaction;
+ get dbDriver(): CustomKnex | Knex.Transaction;
/** Returns the base (non-transactional) database driver */
get knex(): CustomKnex;
get isSqlite(): boolean;
diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts
index b9cfdd4049..909327782f 100644
--- a/packages/nocodb/src/models/Model.ts
+++ b/packages/nocodb/src/models/Model.ts
@@ -9,8 +9,8 @@ import {
import dayjs from 'dayjs';
import { Logger } from '@nestjs/common';
import hash from 'object-hash';
-import type { Transaction } from 'knex';
import type { NcRequest } from 'nocodb-sdk';
+import type { Knex } from 'knex';
import type { BoolType, TableReqType, TableType } from 'nocodb-sdk';
import type { XKnex } from '~/db/CustomKnex';
import type { LinksColumn, LinkToAnotherRecordColumn } from '~/models/index';
@@ -570,7 +570,7 @@ export default class Model implements TableType {
id?: string;
viewId?: string;
dbDriver: XKnex;
- transaction?: XKnex | Transaction;
+ transaction?: XKnex | Knex.Transaction;
model?: Model;
extractDefaultView?: boolean;
source?: Source;