All files / projects-dev/apps/mc-api/src/migrations 1677667388819-AddGambitRogue.ts

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

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 27 28 29 30 31 32 33 34 35 36 37 38 39 40                                                                               
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddGambitRogue1677667388819 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`UPDATE packs SET owned = true WHERE code IN ('MC035', 'MC036', 'MC039')`);
        await queryRunner.query(`
            REPLACE INTO packs VALUES
            ('MC037', 'Gambit', 'Hero', '2023-02-23', true),
            ('MC038', 'Rogue', 'Hero', '2023-02-23', true);
        `);

        await queryRunner.query(`
            REPLACE INTO heroes VALUES
            (61, 'Gambit', 'Remy LeBeau', 'Justice', 'MC037'),
            (62, 'Rogue', 'Anna Marie', 'Protection', 'MC038');
        `);

        await queryRunner.query(`
            REPLACE INTO modular_sets VALUES
            (71, 'Exodus', 'MC037'),
            (72, 'Reavers', 'MC037');
        `);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            DELETE FROM modular_sets WHERE id IN (71, 72);
        `);

        await queryRunner.query(`
            DELETE FROM heroes WHERE id IN (61, 62);
        `);

        await queryRunner.query(`
            DELETE FROM packs WHERE code IN ('MC037', 'MC038');
        `);
        await queryRunner.query(`UPDATE packs SET owned = false WHERE code IN ('MC035', 'MC036', 'MC039')`);
    }
}