migrate db

This commit is contained in:
Kittapath 2024-03-13 16:49:11 +07:00
parent fcbe8e99ef
commit 806fb21c61

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableProfileduty1710323273630 implements MigrationInterface {
name = 'AddTableProfileduty1710323273630'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP FOREIGN KEY \`FK_3b1d1d213fd87c951ba518b8fbc\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` CHANGE \`profileId\` \`profileOtherId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile'`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD CONSTRAINT \`FK_133a9a59af0754634e0d33f7613\` FOREIGN KEY (\`profileOtherId\`) REFERENCES \`profileOther\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` DROP FOREIGN KEY \`FK_133a9a59af0754634e0d33f7613\``);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` CHANGE \`profileOtherId\` \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile'`);
await queryRunner.query(`ALTER TABLE \`profileOtherHistory\` ADD CONSTRAINT \`FK_3b1d1d213fd87c951ba518b8fbc\` FOREIGN KEY (\`profileId\`) REFERENCES \`profileOther\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}