All files / projects-dev/apps/mc-api/src/migrations 1629423362991-AddThanosScenarios.ts

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

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 41 42 43 44 45                                                                                         
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddThanosScenarios1629423362991 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            INSERT INTO modular_sets VALUES
            (23, 'Armies of Titan', 'MC021', 0),
            (24, 'Black Order', 'MC021', 0),
            (25, 'Children of Thanos', 'MC021', 0),
            (26, 'Legions of Hel', 'MC021', 0),
            (27, 'Frost Giants', 'MC021', 0),
            (28, 'Enchantress', 'MC021', 0),
            (29, 'Infinity Gauntlet', 'MC021', 0);
        `);
        await queryRunner.query(`
            INSERT INTO scenarios VALUES
            (18, 'Ebony Maw - Attack on Knowhere', 'MC021', 0, 0, 0, 0),
            (19, 'Tower Defense - Under Siege', 'MC021', 0, 0, 0, 0),
            (20, 'Thanos - The Infinity Stones', 'MC021', 0, 0, 0, 0),
            (21, 'Hela - Odin''s Torment', 'MC021', 0, 0, 0, 0),
            (22, 'Loki - All Hail King Loki', 'MC021', 0, 0, 0, 0);
        `);
        await queryRunner.query(`
            INSERT INTO scenarios_modular_sets VALUES
            (18, 23),
            (18, 24),
            (19, 23),
            (20, 24),
            (20, 25),
            (20, 29),
            (21, 26),
            (21, 27),
            (22, 27),
            (22, 28),
            (22, 29);
        `);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`DELETE FROM scenarios_modular_sets WHERE scenarios IN (18)`);
        await queryRunner.query(`DELETE FROM scenarios WHERE pack='MC021'`);
        await queryRunner.query(`DELETE FROM modular_sets WHERE pack='MC021'`);
    }
}