mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: Add workflow history repository files (no-changelog) (#7071)
This commit is contained in:
parent
689a77cc87
commit
25dc4d7825
|
@ -166,6 +166,9 @@ export async function init(testConnectionOptions?: ConnectionOptions): Promise<v
|
|||
|
||||
connectionState.connected = true;
|
||||
|
||||
/**
|
||||
* @important Do not add to these collections. Inject the repository as a dependency instead.
|
||||
*/
|
||||
collections.AuthIdentity = Container.get(AuthIdentityRepository);
|
||||
collections.AuthProviderSyncHistory = Container.get(AuthProviderSyncHistoryRepository);
|
||||
collections.EventDestinations = Container.get(EventDestinationsRepository);
|
||||
|
|
|
@ -86,6 +86,10 @@ export interface ICredentialsOverwrite {
|
|||
[key: string]: ICredentialDataDecryptedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @important Do not add to these collections. Inject the repository as a dependency instead.
|
||||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
export interface IDatabaseCollections extends Record<string, Repository<any>> {
|
||||
AuthIdentity: AuthIdentityRepository;
|
||||
|
|
28
packages/cli/src/databases/entities/WorkflowHistory.ts
Normal file
28
packages/cli/src/databases/entities/WorkflowHistory.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Column, Entity, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { jsonColumnType } from './AbstractEntity';
|
||||
import { IConnections } from 'n8n-workflow';
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import { WorkflowEntity } from './WorkflowEntity';
|
||||
|
||||
@Entity()
|
||||
export class WorkflowHistory {
|
||||
@PrimaryColumn()
|
||||
versionId: string;
|
||||
|
||||
@Column()
|
||||
workflowId: string;
|
||||
|
||||
@Column(jsonColumnType)
|
||||
nodes: INode[];
|
||||
|
||||
@Column(jsonColumnType)
|
||||
connections: IConnections;
|
||||
|
||||
@Column()
|
||||
authors: string;
|
||||
|
||||
@ManyToOne('WorkflowEntity', {
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
workflow: WorkflowEntity;
|
||||
}
|
|
@ -19,6 +19,7 @@ import { WorkflowTagMapping } from './WorkflowTagMapping';
|
|||
import { WorkflowStatistics } from './WorkflowStatistics';
|
||||
import { ExecutionMetadata } from './ExecutionMetadata';
|
||||
import { ExecutionData } from './ExecutionData';
|
||||
import { WorkflowHistory } from './WorkflowHistory';
|
||||
|
||||
export const entities = {
|
||||
AuthIdentity,
|
||||
|
@ -41,4 +42,5 @@ export const entities = {
|
|||
WorkflowStatistics,
|
||||
ExecutionMetadata,
|
||||
ExecutionData,
|
||||
WorkflowHistory,
|
||||
};
|
||||
|
|
|
@ -15,6 +15,7 @@ export { TagRepository } from './tag.repository';
|
|||
export { UserRepository } from './user.repository';
|
||||
export { VariablesRepository } from './variables.repository';
|
||||
export { WebhookRepository } from './webhook.repository';
|
||||
export { WorkflowHistoryRepository } from './workflowHistory.repository';
|
||||
export { WorkflowRepository } from './workflow.repository';
|
||||
export { WorkflowStatisticsRepository } from './workflowStatistics.repository';
|
||||
export { WorkflowTagMappingRepository } from './workflowTagMapping.repository';
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { Service } from 'typedi';
|
||||
import { DataSource, Repository } from 'typeorm';
|
||||
import { WorkflowHistory } from '../entities/WorkflowHistory';
|
||||
|
||||
@Service()
|
||||
export class WorkflowHistoryRepository extends Repository<WorkflowHistory> {
|
||||
constructor(dataSource: DataSource) {
|
||||
super(WorkflowHistory, dataSource.manager);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { WorkflowHistoryRepository } from '@db/repositories/workflowHistory.repository';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@Service()
|
||||
export class WorkflowHistoryService {
|
||||
constructor(private readonly workflowHistoryRepository: WorkflowHistoryRepository) {}
|
||||
}
|
Loading…
Reference in a new issue