migrate db

This commit is contained in:
kittapath 2024-10-08 22:07:04 +07:00
parent 12b2a2f1fd
commit 9d8e14b393
7 changed files with 248 additions and 0 deletions

88
src/entities/Workflow.ts Normal file
View file

@ -0,0 +1,88 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { State } from "./State";
import { CommandSys } from "./CommandSys";
import { PosLevel } from "./PosLevel";
import { PosType } from "./PosType";
@Entity("workflow")
export class Workflow extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อ flow",
length: 255,
default: null,
})
name: string;
@Column({
nullable: true,
comment: "ระบบ",
length: 255,
default: null,
})
category: string;
// @Column({
// nullable: true,
// comment: "กรุ๊ปเลือด",
// length: 255,
// default: null,
// })
// rank: string;
// @Column({
// nullable: true,
// comment: "กรุ๊ปเลือด",
// length: 255,
// default: null,
// })
// executive: string;
// @Column({
// nullable: true,
// comment: "หมวดหมู่ระบบ",
// length: 255,
// default: null,
// })
// system: string;
@OneToMany(() => State, (state) => state.workflow)
states: State[];
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง commandSys",
default: null,
})
commandSysId: string;
@ManyToOne(() => CommandSys, (commandSys) => commandSys.workflows)
@JoinColumn({ name: "commandSysId" })
commandSys: CommandSys;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง posLevel",
default: null,
})
posLevelId: string;
@ManyToOne(() => PosLevel, (posLevel) => posLevel.workflows)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง posType",
default: null,
})
posTypeId: string;
@ManyToOne(() => PosType, (posType) => posType.workflows)
@JoinColumn({ name: "posTypeId" })
posType: PosType;
}