diff --git a/src/migration/1710323273630-add_table_profileduty.ts b/src/migration/1710323273630-add_table_profileduty.ts new file mode 100644 index 00000000..4c4faae5 --- /dev/null +++ b/src/migration/1710323273630-add_table_profileduty.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AddTableProfileduty1710323273630 implements MigrationInterface { + name = 'AddTableProfileduty1710323273630' + + public async up(queryRunner: QueryRunner): Promise { + 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 { + 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`); + } + +}