From 775d3cd0d4f976f54d57fc2267cd2db6f58943c9 Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 23 Sep 2023 17:45:47 -0500 Subject: [PATCH] fix linter down method in migration --- ...1695508418383-RemoveSafeTransactionHash.ts | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/migrations/1695508418383-RemoveSafeTransactionHash.ts b/migrations/1695508418383-RemoveSafeTransactionHash.ts index d549ff5..24da4fe 100644 --- a/migrations/1695508418383-RemoveSafeTransactionHash.ts +++ b/migrations/1695508418383-RemoveSafeTransactionHash.ts @@ -1,4 +1,4 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; +import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; export class RemoveSafeTransactionHash1695508418383 implements MigrationInterface @@ -15,5 +15,22 @@ export class RemoveSafeTransactionHash1695508418383 } } - public async down(queryRunner: QueryRunner): Promise {} + public async down(queryRunner: QueryRunner): Promise { + const table = await queryRunner.getTable('multisig_session'); + if (!table) return; + + const safeTransactionHashColumnExists = table.columns.some( + c => c.name === 'safeTransactionHash', + ); + if (!safeTransactionHashColumnExists) { + await queryRunner.addColumn( + 'multisig_session', + new TableColumn({ + name: 'safeTransactionHash', + type: 'varchar', + isNullable: true, + }), + ); + } + } }