Browse Source

refactor: cleanup and add logs

pull/9770/head
Pranav C 3 weeks ago
parent
commit
326aecad15
  1. 8
      packages/nocodb/src/modules/jobs/migration-jobs/nc_job_003_recover_links.ts
  2. 12
      packages/nocodb/src/modules/jobs/migration-jobs/nc_job_004_cleanup_duplicate_column.ts

8
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);

12
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);

Loading…
Cancel
Save