All files / projects-dev/apps/mc-api/src/migrations 1643596197951-AddNewCustomPacks202201.ts

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

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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                                                                                                                                                                     
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddNewCustomPacks2022011643596197951 implements MigrationInterface {
    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            REPLACE INTO packs VALUES
            ('CUS14', 'Green Lanterns', 'Custom', '2022-01-31'),
            ('CUS15', 'Green Arrow', 'Custom', '2022-01-31'),
            ('CUS16', 'Harley Queen', 'Custom', '2022-01-31'),
            ('CUS17', 'US Agent', 'Custom', '2022-01-31'),
            ('CUS18', 'Winter Soldier', 'Custom', '2022-01-31'),
            ('CUS18', 'Captain America', 'Custom', '2022-01-31'),
            ('CUS19', 'Juggernaut', 'Custom', '2022-01-31'),
            ('CUS20', 'Amanda Waller', 'Custom', '2022-01-31'),
            ('CUS21', 'War Of The Realms', 'Custom', '2022-01-31');
        `);

        await queryRunner.query(`
            REPLACE INTO heroes (id, name, alterEgo, aspects, packCode) VALUES
            (42, 'Green Lantern', 'Hal Jordan', null, 'CUS14'),
            (43, 'Green Lantern', 'John Stewart', null, 'CUS14'),
            (44, 'Green Lantern', 'Guy Gardner', null, 'CUS14'),
            (45, 'Green Lantern', 'Kyle Rayner', null, 'CUS14'),
            (46, 'Green Arrow', 'Oliver Queen', null, 'CUS15'),
            (47, 'Harley Queen', 'Dr. Harleen Quinzel', null, 'CUS16'),
            (48, 'US Agent', 'John Walker', null, 'CUS17'),
            (49, 'Winter Soldier', 'Bucky Barnes', null, 'CUS18'),
            (50, 'Captain America', 'Sam Wilson', null, 'CUS19');
        `);

        await queryRunner.query(`
            REPLACE INTO modular_sets VALUES
            (45, 'Zod Unleashed', 'CUS20'),
            (46, 'Suicid Squad', 'CUS20'),
            (47, 'Svartalfheim', 'CUS21'),
            (48, 'The B-Team', 'CUS20'),
            (49, 'Corporate Meddling', 'CUS21'),
            (50, 'Uncharted Territory', 'CUS21');
        `);

        await queryRunner.query(`
            REPLACE INTO scenarios VALUES
            (31, 'Juggernaut - Crimson Rampgage', 'CUS19'),
            (32, 'Amanda Waller - New Mission, New Team', 'CUS20'),
            (33, 'Minotaur - Roxxon', 'CUS21'),
            (34, 'Laufey - Journey To Jotunheim', 'CUS21'),
            (35, 'Malekith - Invasion Of Midgard', 'CUS21');
        `);

        await queryRunner.query(`
            INSERT INTO scenarios_modular_sets VALUES
            (32, 46),
            (32, 48),
            (32, 45),
            (33, 49),
            (34, 50),
            (35, 47);
        `);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`
            DELETE FROM scenarios_modular_sets WHERE id IN (31, 32, 33, 34, 35);
        `);

        await queryRunner.query(`
            DELETE FROM scenarios WHERE id IN (31, 32, 33, 34, 35);
        `);

        await queryRunner.query(`
            DELETE FROM modular_sets WHERE id IN (45, 46, 47, 48, 49, 50);
        `);

        await queryRunner.query(`
            DELETE FROM heroes WHERE id IN (42, 43, 44, 45, 46, 47, 48, 49, 50);
        `);

        await queryRunner.query(`
            DELETE FROM packs WHERE code IN ('CUS14', 'CUS15', 'CUS16', 'CUS17', 'CUS18', 'CUS19', 'CUS20', 'CUS21');
        `);
    }
}