From 326aecad15f3fdb887a77a921b50e10ba82b0e6d Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 5 Nov 2024 18:08:05 +0000 Subject: [PATCH] refactor: cleanup and add logs --- .../jobs/migration-jobs/nc_job_003_recover_links.ts | 8 +++----- .../nc_job_004_cleanup_duplicate_column.ts | 12 +----------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_003_recover_links.ts b/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_003_recover_links.ts index 5d19f04cc2..812f82d985 100644 --- a/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_003_recover_links.ts +++ b/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_003_recover_links.ts @@ -4,7 +4,6 @@ import { RelationTypes, UITypes } from 'nocodb-sdk'; import type { MetaService } from '~/meta/meta.service'; import Noco from '~/Noco'; import { MetaTable } from '~/utils/globals'; -import { ThumbnailGeneratorProcessor } from '~/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor'; import { isEE } from '~/utils'; import { Column } from '~/models'; @@ -16,12 +15,10 @@ import { Column } from '~/models'; export class RecoverLinksMigration { private readonly debugLog = debug('nc:migration-jobs:recover-links'); - constructor( - private readonly thumbnailGeneratorProcessor: ThumbnailGeneratorProcessor, - ) {} + constructor() {} log = (...msgs: string[]) => { - console.log('[nc_job_003_thumbnail]: ', ...msgs); + console.log('[nc_job_003_recover_links]: ', ...msgs); }; async job() { @@ -317,6 +314,7 @@ export class RecoverLinksMigration { this.log(`Recovered column '${column.title}' (ID: '${column.id}')`); } } + this.log('Recovery completed'); await (await ncMeta).commit(); } catch (e) { await (await ncMeta).rollback(e); diff --git a/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_004_cleanup_duplicate_column.ts b/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_004_cleanup_duplicate_column.ts index 1c7afb06cd..c28357dd5b 100644 --- a/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_004_cleanup_duplicate_column.ts +++ b/packages/nocodb/src/modules/jobs/migration-jobs/nc_job_004_cleanup_duplicate_column.ts @@ -1,13 +1,5 @@ -import path from 'path'; import debug from 'debug'; import { Injectable } from '@nestjs/common'; -import PQueue from 'p-queue'; -import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2'; -import Noco from '~/Noco'; -import mimetypes from '~/utils/mimeTypes'; -import { RootScopes } from '~/utils/globals'; -import { ThumbnailGeneratorProcessor } from '~/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor'; -import { getPathFromUrl } from '~/helpers/attachmentHelpers'; @Injectable() export class CleanupDuplicateColumnMigration { @@ -15,9 +7,7 @@ export class CleanupDuplicateColumnMigration { 'nc:migration-jobs:cleanup-duplicate-column', ); - constructor( - private readonly thumbnailGeneratorProcessor: ThumbnailGeneratorProcessor, - ) {} + constructor() {} log = (...msgs: string[]) => { console.log('[nc_job_004_cleanup_duplicate_column]: ', ...msgs);