From 28d21a230d596a141bd51d82644d111bf0b3336f Mon Sep 17 00:00:00 2001 From: ali ebrahimi Date: Mon, 12 Aug 2024 15:44:03 +0330 Subject: [PATCH] add migration for create Qacc third party --- .../1723464500207-seedThirdPartyForQAcc.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 migrations/1723464500207-seedThirdPartyForQAcc.ts diff --git a/migrations/1723464500207-seedThirdPartyForQAcc.ts b/migrations/1723464500207-seedThirdPartyForQAcc.ts new file mode 100644 index 0000000..3f01d40 --- /dev/null +++ b/migrations/1723464500207-seedThirdPartyForQAcc.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class SeedThirdPartyForQAcc1723464500207 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + if ( + process.env.NODE_ENV === 'test' || + process.env.NODE_ENV === 'development' + ) { + // Create third part record for notifyreward in development and test ENVs + await queryRunner.query(` + INSERT INTO third_party( + "microService", secret, "isActive") + VALUES ('qacc', 'secret', true); + `); + } + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(` + DELETE FROM third_party + WHERE "microService" = 'qacc'; + `); + } +}