Skip to content

Commit

Permalink
change to one-to-many
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Dec 4, 2023
1 parent 9269002 commit 1305660
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/pool/pool.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ model PrismaPoolStakingGauge {
chain Chain
gaugeAddress String
votingGauge PrismaVotingGauge?
votingGauge PrismaVotingGauge[]
rewards PrismaPoolStakingGaugeReward[]
status PrismaPoolStakingGaugeStatus @default(ACTIVE)
version Int @default(1)
Expand Down
2 changes: 1 addition & 1 deletion modules/pool/pool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export class PoolService {

if (gauge && gauge.votingGauge)
await prisma.prismaVotingGauge.deleteMany({
where: { chain: this.chain, id: gauge.votingGauge.id },
where: { chain: this.chain, id: { in: gauge.votingGauge.map((gauge) => gauge.id) } },
});

await prisma.prismaPoolStakingGauge.deleteMany({
Expand Down
2 changes: 1 addition & 1 deletion modules/vebal/vebal.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ model PrismaVotingGauge {
id String
chain Chain
stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain])
stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain])
status PrismaVotingGaugeStatus @default(ACTIVE)
gaugeAddress String
stakingGaugeId String?
Expand Down
5 changes: 2 additions & 3 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ model PrismaPoolStakingGauge {
chain Chain
gaugeAddress String
votingGauge PrismaVotingGauge?
votingGauge PrismaVotingGauge[]
rewards PrismaPoolStakingGaugeReward[]
status PrismaPoolStakingGaugeStatus @default(ACTIVE)
version Int @default(1)
Expand Down Expand Up @@ -846,12 +846,11 @@ enum PrismaVotingGaugeStatus {

model PrismaVotingGauge {
@@id([id, chain])
@@unique([stakingGaugeId, chain])
id String
chain Chain
stakingGauge PrismaPoolStakingGauge? @relation(fields: [stakingGaugeId, chain], references: [id, chain])
stakingGauge PrismaPoolStakingGauge? @relation(fields: [id, chain], references: [id, chain])
status PrismaVotingGaugeStatus @default(ACTIVE)
gaugeAddress String
stakingGaugeId String?
Expand Down

0 comments on commit 1305660

Please sign in to comment.