From 36150ec9facd0cd0398dd1b47a852dd9f968adc6 Mon Sep 17 00:00:00 2001 From: franz Date: Thu, 1 Feb 2024 15:50:26 +0100 Subject: [PATCH] create dynamic data on update if missing --- modules/pool/lib/pool-creator.service.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/pool/lib/pool-creator.service.ts b/modules/pool/lib/pool-creator.service.ts index 7785cd069..351844b3a 100644 --- a/modules/pool/lib/pool-creator.service.ts +++ b/modules/pool/lib/pool-creator.service.ts @@ -236,6 +236,20 @@ export class PoolCreatorService { }); } + await prisma.prismaPoolTokenDynamicData.createMany({ + skipDuplicates: true, + data: pool.tokens!.map((token) => ({ + id: token.id, + chain: this.chain, + poolTokenId: token.id, + blockNumber, + priceRate: token.priceRate || '1.0', + weight: token.weight, + balance: token.balance, + balanceUSD: 0, + })), + }); + // TODO: It's just a quick fix. Remove after merging json column replacement for tables if (pool.poolType!.includes('Gyro')) { await prisma.prismaPoolGyroData.upsert({