แก้ db workflow
This commit is contained in:
parent
7e6fdcb15e
commit
87b6fdf0d2
5 changed files with 83 additions and 53 deletions
|
|
@ -77,8 +77,8 @@ export class CommandSys {
|
|||
@OneToMany(() => Assign, (assgin) => assgin.commandAssignSys)
|
||||
assgins: Assign[];
|
||||
|
||||
@OneToMany(() => Workflow, (workflow) => workflow.commandSys)
|
||||
workflows: Workflow[];
|
||||
// @OneToMany(() => Workflow, (workflow) => workflow.commandSys)
|
||||
// workflows: Workflow[];
|
||||
}
|
||||
|
||||
export class CreateCommandSys {
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ export class PosLevel extends EntityBase {
|
|||
@OneToMany(() => Profile, (profile) => profile.posLevel)
|
||||
profiles: Profile[];
|
||||
|
||||
@OneToMany(() => Workflow, (workflow) => workflow.posLevel)
|
||||
workflows: Workflow[];
|
||||
// @OneToMany(() => Workflow, (workflow) => workflow.posLevel)
|
||||
// workflows: Workflow[];
|
||||
}
|
||||
|
||||
export class CreatePosLevel {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ export class PosType extends EntityBase {
|
|||
@OneToMany(() => Profile, (profile) => profile.posType)
|
||||
profiles: Profile[];
|
||||
|
||||
@OneToMany(() => Workflow, (workflow) => workflow.posType)
|
||||
workflows: Workflow[];
|
||||
// @OneToMany(() => Workflow, (workflow) => workflow.posType)
|
||||
// workflows: Workflow[];
|
||||
}
|
||||
|
||||
export class CreatePosType {
|
||||
|
|
|
|||
|
|
@ -23,66 +23,66 @@ export class Workflow extends EntityBase {
|
|||
})
|
||||
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;
|
||||
// @Column({
|
||||
// nullable: true,
|
||||
// length: 40,
|
||||
// comment: "คีย์นอก(FK)ของตาราง commandSys",
|
||||
// default: null,
|
||||
// })
|
||||
// commandSysId: string;
|
||||
|
||||
@ManyToOne(() => CommandSys, (commandSys) => commandSys.workflows)
|
||||
@JoinColumn({ name: "commandSysId" })
|
||||
commandSys: CommandSys;
|
||||
// @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;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง posLevel",
|
||||
comment: "ชื่อระบบ",
|
||||
length: 100,
|
||||
default: null,
|
||||
})
|
||||
posLevelId: string;
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.workflows)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel: PosLevel;
|
||||
commandSysName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง posType",
|
||||
comment: "ชื่อระดับ",
|
||||
length: 100,
|
||||
default: null,
|
||||
})
|
||||
posTypeId: string;
|
||||
posLevelName: string;
|
||||
|
||||
@ManyToOne(() => PosType, (posType) => posType.workflows)
|
||||
@JoinColumn({ name: "posTypeId" })
|
||||
posType: PosType;
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อประเภท",
|
||||
length: 100,
|
||||
default: null,
|
||||
})
|
||||
posTypeName: string;
|
||||
}
|
||||
|
|
|
|||
30
src/migration/1728442861469-add_table_workflow1.ts
Normal file
30
src/migration/1728442861469-add_table_workflow1.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableWorkflow11728442861469 implements MigrationInterface {
|
||||
name = 'AddTableWorkflow11728442861469'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_0eadcb967c5bdb18867395b8bf9\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_248dca7108cc3ba484d7eac2bc2\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP FOREIGN KEY \`FK_77889a7cde943b64fc28dd06025\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`commandSysId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posLevelId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posTypeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`commandSysName\` varchar(100) NULL COMMENT 'ชื่อระบบ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posLevelName\` varchar(100) NULL COMMENT 'ชื่อระดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posTypeName\` varchar(100) NULL COMMENT 'ชื่อประเภท'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posTypeName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`posLevelName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`commandSysName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posTypeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posType'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`posLevelId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง posLevel'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`commandSysId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSys'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_77889a7cde943b64fc28dd06025\` FOREIGN KEY (\`posTypeId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_248dca7108cc3ba484d7eac2bc2\` FOREIGN KEY (\`commandSysId\`) REFERENCES \`commandSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD CONSTRAINT \`FK_0eadcb967c5bdb18867395b8bf9\` FOREIGN KEY (\`posLevelId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue