Skip to content

Commit

Permalink
delete cleanup based on constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Jan 12, 2024
1 parent dd2ee5a commit 90ebc90
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions modules/pool/pool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,8 @@ export class PoolService {
where: { chain: this.chain, poolId: poolId },
});

const poolTokenIds = poolTokens.map((poolToken) => poolToken.id);
const poolTokenAddresses = poolTokens.map((poolToken) => poolToken.address);

await prisma.prismaPoolSnapshot.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaTokenType.deleteMany({
where: { chain: this.chain, tokenAddress: pool.address },
});
Expand All @@ -389,50 +384,10 @@ export class PoolService {
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolTokenDynamicData.deleteMany({
where: { chain: this.chain, poolTokenId: { in: poolTokenIds } },
});

await prisma.prismaTokenDynamicData.deleteMany({
where: { chain: this.chain, tokenAddress: { in: poolTokenAddresses } },
});

await prisma.prismaPoolToken.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolDynamicData.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolToken.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolLinearData.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolGyroData.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolExpandedTokens.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolLinearDynamicData.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolAprItem.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

await prisma.prismaPoolSwap.deleteMany({
where: { chain: this.chain, poolId: poolId },
});

const poolStaking = await prisma.prismaPoolStaking.findMany({
where: { chain: this.chain, poolId: poolId },
});
Expand Down

0 comments on commit 90ebc90

Please sign in to comment.