From e0f8b8dd1de427ce8cb014c954b9444ff33ffedd Mon Sep 17 00:00:00 2001 From: amateima <89395931+amateima@users.noreply.github.com> Date: Fri, 22 Nov 2024 19:08:42 +0200 Subject: [PATCH] fix: sync migrations with events entities (#112) --- .../1732294733827-FinalisedEvents.ts | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 packages/indexer-database/src/migrations/1732294733827-FinalisedEvents.ts diff --git a/packages/indexer-database/src/migrations/1732294733827-FinalisedEvents.ts b/packages/indexer-database/src/migrations/1732294733827-FinalisedEvents.ts new file mode 100644 index 0000000..48841e2 --- /dev/null +++ b/packages/indexer-database/src/migrations/1732294733827-FinalisedEvents.ts @@ -0,0 +1,89 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class FinalisedEvents1732294733827 implements MigrationInterface { + name = "FinalisedEvents1732294733827"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_canceled" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_executed" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_disputed" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."proposed_root_bundle" ALTER COLUMN "chainIds" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."proposed_root_bundle" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."set_pool_rebalance_route" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."v3_funds_deposited" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."filled_v3_relay" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."requested_v3_slow_fill" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."requested_speed_up_v3_deposit" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."relayed_root_bundle" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."executed_relayer_refund_root" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."tokens_bridged" ALTER COLUMN "finalised" DROP DEFAULT`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "evm"."tokens_bridged" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."executed_relayer_refund_root" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."relayed_root_bundle" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."requested_speed_up_v3_deposit" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."requested_v3_slow_fill" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."filled_v3_relay" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."v3_funds_deposited" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."set_pool_rebalance_route" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."proposed_root_bundle" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."proposed_root_bundle" ALTER COLUMN "chainIds" SET DEFAULT '[]'`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_disputed" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_executed" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + await queryRunner.query( + `ALTER TABLE "evm"."root_bundle_canceled" ALTER COLUMN "finalised" SET DEFAULT true`, + ); + } +}