migrate
This commit is contained in:
parent
a826726c80
commit
d57d4220dd
1 changed files with 20 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileemployeeAddPk41715660157678 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileemployeeAddPk41715660157678'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildren\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildren\` ADD CONSTRAINT \`FK_50655e719f668b71918a6f22e6d\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` ADD CONSTRAINT \`FK_6a37dfb48ea6108cba60b9d4f69\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` DROP FOREIGN KEY \`FK_6a37dfb48ea6108cba60b9d4f69\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildren\` DROP FOREIGN KEY \`FK_50655e719f668b71918a6f22e6d\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildrenHistory\` DROP COLUMN \`profileEmployeeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileChildren\` DROP COLUMN \`profileEmployeeId\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue