All files / projects-dev/apps/mc-api/src/migrations 1692432090654-AddNewPacksSummer2023_02.ts

0% Statements 0/25
0% Branches 0/1
0% Functions 0/1
0% Lines 0/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                                   
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddNewPacksSummer2023021692432090654 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`UPDATE packs SET releaseDate = '2023-08-18', owned = true WHERE code = 'MC040'`);

        await queryRunner.query(`INSERT IGNORE INTO packs VALUES ('MC044', 'Deadpool', 'Hero', '2023-11-30', false)`);

        await queryRunner.query(
            `ALTER TABLE \`heroes\` CHANGE \`aspects\` \`aspects\` SET('Aggression','Justice','Protection','Leadership','Pool') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;`,
        );

        await queryRunner.query(`INSERT IGNORE INTO heroes VALUES (68, 'Deadpool', 'Wade Wilson', 'Pool', 'MC044')`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`DELETE FROM heroes WHERE pack_code IN ('MC044')`);

        await queryRunner.query(`DELETE FROM packs WHERE code IN ('MC044')`);

        await queryRunner.query(
            `ALTER TABLE \`heroes\` CHANGE \`aspects\` \`aspects\` SET('Aggression','Justice','Protection','Leadership') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL;`,
        );
    }
}