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, + }), + ); + } + } }