migrate
This commit is contained in:
parent
8e8a259295
commit
5d185ee60e
2 changed files with 6 additions and 4 deletions
|
|
@ -49,11 +49,11 @@ export class EmployeePosition extends EntityBase {
|
||||||
})
|
})
|
||||||
posMasterTempId: string;
|
posMasterTempId: string;
|
||||||
|
|
||||||
@ManyToOne(() => EmployeePosMaster, (posMaster) => posMaster)
|
@ManyToOne(() => EmployeePosMaster, (posMaster) => posMaster.positions)
|
||||||
@JoinColumn({ name: "posMasterId" })
|
@JoinColumn({ name: "posMasterId" })
|
||||||
posMaster: EmployeePosMaster;
|
posMaster: EmployeePosMaster;
|
||||||
|
|
||||||
@ManyToOne(() => EmployeeTempPosMaster, (posMaster) => posMaster)
|
@ManyToOne(() => EmployeeTempPosMaster, (posMaster) => posMaster.positions)
|
||||||
@JoinColumn({ name: "posMasterTempId" })
|
@JoinColumn({ name: "posMasterTempId" })
|
||||||
posMasterTemp: EmployeeTempPosMaster;
|
posMasterTemp: EmployeeTempPosMaster;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
export class Addtableorgtemp11740033601269 implements MigrationInterface {
|
export class Addtableorgtemp11740034804747 implements MigrationInterface {
|
||||||
name = 'Addtableorgtemp11740033601269'
|
name = 'Addtableorgtemp11740034804747'
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
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`);
|
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> {
|
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 FOREIGN KEY \`FK_d98cc02c1c2f9830afcb1493b00\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`employeePosition\` DROP COLUMN \`posMasterTempId\``);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue