mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
fix(core): Ensure valid logger
is passed to every migration (no-changelog) (#6563)
This commit is contained in:
parent
b9e5211735
commit
f841f187ec
|
@ -5,7 +5,7 @@ import type { QueryRunner } from 'typeorm/query-runner/QueryRunner';
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { getLogger } from '@/Logger';
|
import { getLogger } from '@/Logger';
|
||||||
import { inTest } from '@/constants';
|
import { inTest } from '@/constants';
|
||||||
import type { Migration } from '@db/types';
|
import type { Migration, MigrationContext } from '@db/types';
|
||||||
|
|
||||||
const logger = getLogger();
|
const logger = getLogger();
|
||||||
|
|
||||||
|
@ -68,7 +68,13 @@ export const wrapMigration = (migration: Migration) => {
|
||||||
const dbName = config.getEnv(`database.${dbType === 'mariadb' ? 'mysqldb' : dbType}.database`);
|
const dbName = config.getEnv(`database.${dbType === 'mariadb' ? 'mysqldb' : dbType}.database`);
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
const tablePrefix = config.getEnv('database.tablePrefix');
|
||||||
const migrationName = migration.name;
|
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;
|
const { up, down } = migration.prototype;
|
||||||
Object.assign(migration.prototype, {
|
Object.assign(migration.prototype, {
|
||||||
|
|
Loading…
Reference in a new issue