Skip to content

Commit

Permalink
fix(core): Ensure valid logger is passed to every migration (no-cha…
Browse files Browse the repository at this point in the history
…ngelog) (n8n-io#6563)
  • Loading branch information
netroy authored Jun 28, 2023
1 parent db81342 commit 9bd49e8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/cli/src/databases/utils/migrationHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { QueryRunner } from 'typeorm/query-runner/QueryRunner';
import config from '@/config';
import { getLogger } from '@/Logger';
import { inTest } from '@/constants';
import type { Migration } from '@db/types';
import type { Migration, MigrationContext } from '@db/types';

const logger = getLogger();

Expand Down Expand Up @@ -68,7 +68,13 @@ export const wrapMigration = (migration: Migration) => {
const dbName = config.getEnv(`database.${dbType === 'mariadb' ? 'mysqldb' : dbType}.database`);
const tablePrefix = config.getEnv('database.tablePrefix');
const migrationName = migration.name;
const context = { tablePrefix, dbType, dbName, migrationName };
const context: Omit<MigrationContext, 'queryRunner'> = {
tablePrefix,
dbType,
dbName,
migrationName,
logger,
};

const { up, down } = migration.prototype;
Object.assign(migration.prototype, {
Expand Down

0 comments on commit 9bd49e8

Please sign in to comment.