mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
🚧 🐘 setup TageEntity and relationship
This commit is contained in:
parent
e043e89f7f
commit
1231c4d670
|
@ -72,12 +72,13 @@ export interface IWebhookDb {
|
||||||
|
|
||||||
export interface IWorkflowBase extends IWorkflowBaseWorkflow {
|
export interface IWorkflowBase extends IWorkflowBaseWorkflow {
|
||||||
id?: number | string;
|
id?: number | string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITagDb {
|
export interface ITagDb {
|
||||||
id: number | string;
|
id: number | string;
|
||||||
|
name: string;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
23
packages/cli/src/databases/sqlite/TagEntity.ts
Normal file
23
packages/cli/src/databases/sqlite/TagEntity.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { ITagDb } from '../../Interfaces';
|
||||||
|
import { WorkflowEntity } from './WorkflowEntity';
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class TagEntity implements ITagDb {
|
||||||
|
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({ unique: true, length: 24 })
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
createdAt: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
updatedAt: Date;
|
||||||
|
|
||||||
|
@ManyToMany(() => WorkflowEntity, workflowEntity => workflowEntity.tags)
|
||||||
|
workflows: WorkflowEntity[];
|
||||||
|
}
|
|
@ -12,9 +12,15 @@ import {
|
||||||
import {
|
import {
|
||||||
Column,
|
Column,
|
||||||
Entity,
|
Entity,
|
||||||
|
JoinTable,
|
||||||
|
ManyToMany,
|
||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
|
import {
|
||||||
|
TagEntity,
|
||||||
|
} from './TagEntity';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class WorkflowEntity implements IWorkflowDb {
|
export class WorkflowEntity implements IWorkflowDb {
|
||||||
|
|
||||||
|
@ -52,4 +58,8 @@ export class WorkflowEntity implements IWorkflowDb {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
staticData?: IDataObject;
|
staticData?: IDataObject;
|
||||||
|
|
||||||
|
@ManyToMany(() => TagEntity, tagEntity => tagEntity.workflows)
|
||||||
|
@JoinTable({ name: "workflows_tags" })
|
||||||
|
tags: TagEntity[];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue