mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
refactor(core): Remove dead code that disabled auto-generated ids during import (no-changelog) (#9601)
This commit is contained in:
parent
1a982d51b3
commit
3298914bc4
|
@ -8,7 +8,6 @@ import type { EntityManager } from '@n8n/typeorm';
|
||||||
import * as Db from '@/Db';
|
import * as Db from '@/Db';
|
||||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||||
import { disableAutoGeneratedIds } from '@db/utils/commandHelpers';
|
|
||||||
import { BaseCommand } from '../BaseCommand';
|
import { BaseCommand } from '../BaseCommand';
|
||||||
import type { ICredentialsEncrypted } from 'n8n-workflow';
|
import type { ICredentialsEncrypted } from 'n8n-workflow';
|
||||||
import { ApplicationError, jsonParse } from 'n8n-workflow';
|
import { ApplicationError, jsonParse } from 'n8n-workflow';
|
||||||
|
@ -47,11 +46,6 @@ export class ImportCredentialsCommand extends BaseCommand {
|
||||||
|
|
||||||
private transactionManager: EntityManager;
|
private transactionManager: EntityManager;
|
||||||
|
|
||||||
async init() {
|
|
||||||
disableAutoGeneratedIds(CredentialsEntity);
|
|
||||||
await super.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(): Promise<void> {
|
async run(): Promise<void> {
|
||||||
const { flags } = await this.parse(ImportCredentialsCommand);
|
const { flags } = await this.parse(ImportCredentialsCommand);
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@ import fs from 'fs';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
|
|
||||||
import { UM_FIX_INSTRUCTION } from '@/constants';
|
import { UM_FIX_INSTRUCTION } from '@/constants';
|
||||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||||
import { disableAutoGeneratedIds } from '@db/utils/commandHelpers';
|
|
||||||
import { generateNanoId } from '@db/utils/generators';
|
import { generateNanoId } from '@db/utils/generators';
|
||||||
import { UserRepository } from '@db/repositories/user.repository';
|
import { UserRepository } from '@db/repositories/user.repository';
|
||||||
import { WorkflowRepository } from '@db/repositories/workflow.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> {
|
async run(): Promise<void> {
|
||||||
const { flags } = await this.parse(ImportWorkflowsCommand);
|
const { flags } = await this.parse(ImportWorkflowsCommand);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
|
||||||
};
|
|
Loading…
Reference in a new issue