This commit is contained in:
kittapath 2025-02-20 14:04:54 +07:00
parent 8e8a259295
commit 5d185ee60e
2 changed files with 6 additions and 4 deletions

View file

@ -49,11 +49,11 @@ export class EmployeePosition extends EntityBase {
})
posMasterTempId: string;
@ManyToOne(() => EmployeePosMaster, (posMaster) => posMaster)
@ManyToOne(() => EmployeePosMaster, (posMaster) => posMaster.positions)
@JoinColumn({ name: "posMasterId" })
posMaster: EmployeePosMaster;
@ManyToOne(() => EmployeeTempPosMaster, (posMaster) => posMaster)
@ManyToOne(() => EmployeeTempPosMaster, (posMaster) => posMaster.positions)
@JoinColumn({ name: "posMasterTempId" })
posMasterTemp: EmployeeTempPosMaster;

View file

@ -1,14 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Addtableorgtemp11740033601269 implements MigrationInterface {
name = 'Addtableorgtemp11740033601269'
export class Addtableorgtemp11740034804747 implements MigrationInterface {
name = 'Addtableorgtemp11740034804747'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosition\` ADD \`posMasterTempId\` varchar(40) NULL COMMENT 'เชื่อมโยงกับตารางเลขที่ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`employeePosition\` ADD CONSTRAINT \`FK_d98cc02c1c2f9830afcb1493b00\` FOREIGN KEY (\`posMasterTempId\`) REFERENCES \`employeeTempPosMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP FOREIGN KEY \`FK_d98cc02c1c2f9830afcb1493b00\``);
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP COLUMN \`posMasterTempId\``);
}
}