import { MigrationInterface, QueryRunner } from "typeorm";

export class AddTableProfile61707211501053 implements MigrationInterface {
    name = 'AddTableProfile61707211501053'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_22499e79738c6873fc7ede3f6dd\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` DROP FOREIGN KEY \`FK_9f765a0fef405dfafbd1b5f6c0a\``);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_22499e79738c6873fc7ede3f6dd\` FOREIGN KEY (\`next_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE \`posMaster\` ADD CONSTRAINT \`FK_9f765a0fef405dfafbd1b5f6c0a\` FOREIGN KEY (\`current_holderId\`) REFERENCES \`posMaster\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
    }

}
