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`);
    }

}
