refactor(core): Remove dead code that disabled auto-generated ids during import (no-changelog) (#9601)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-06-03 16:12:31 +02:00 committed by GitHub
parent 1a982d51b3
commit 3298914bc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 24 deletions

View file

@ -8,7 +8,6 @@ import type { EntityManager } from '@n8n/typeorm';
import * as Db from '@/Db';
import { SharedCredentials } from '@db/entities/SharedCredentials';
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { disableAutoGeneratedIds } from '@db/utils/commandHelpers';
import { BaseCommand } from '../BaseCommand';
import type { ICredentialsEncrypted } from 'n8n-workflow';
import { ApplicationError, jsonParse } from 'n8n-workflow';
@ -47,11 +46,6 @@ export class ImportCredentialsCommand extends BaseCommand {
private transactionManager: EntityManager;
async init() {
disableAutoGeneratedIds(CredentialsEntity);
await super.init();
}
async run(): Promise<void> {
const { flags } = await this.parse(ImportCredentialsCommand);

View file

@ -5,8 +5,7 @@ import fs from 'fs';
import glob from 'fast-glob';
import { UM_FIX_INSTRUCTION } from '@/constants';
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { disableAutoGeneratedIds } from '@db/utils/commandHelpers';
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { generateNanoId } from '@db/utils/generators';
import { UserRepository } from '@db/repositories/user.repository';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
@ -62,11 +61,6 @@ export class ImportWorkflowsCommand extends BaseCommand {
}),
};
async init() {
disableAutoGeneratedIds(WorkflowEntity);
await super.init();
}
async run(): Promise<void> {
const { flags } = await this.parse(ImportWorkflowsCommand);

View file

@ -1,11 +0,0 @@
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { getMetadataArgsStorage } from '@n8n/typeorm';
export const disableAutoGeneratedIds = (
entityClass: typeof WorkflowEntity | typeof CredentialsEntity,
): void => {
const decoratorMetadata = getMetadataArgsStorage().generations;
const index = decoratorMetadata.findIndex((metadata) => metadata.target === entityClass);
decoratorMetadata.splice(index, 1);
};