Skip to content

Commit

Permalink
fix sftmx sync
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Dec 21, 2023
1 parent a302978 commit d50bb7d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
11 changes: 6 additions & 5 deletions modules/sftmx/sftmx.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ model PrismaSftmxStakingData {

model PrismaSftmxWithdrawalRequest {
id String @id
ftmStakingId PrismaSftmxStakingData @relation(fields:[id], references: [id])
ftmStakingId String
ftmStaking PrismaSftmxStakingData @relation(fields:[ftmStakingId], references: [id])
user String
amountSftmx String
requestTimestamp Int
isWithdrawn Boolean
user String
amountSftmx String
requestTimestamp Int
isWithdrawn Boolean
}
2 changes: 1 addition & 1 deletion modules/sftmx/sftmx.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class SftmxService {
for (const request of allWithdrawalRequests) {
const requestData = {
id: request.id,
ftmStaking: this.stakingContractAddress,
ftmStakingId: this.stakingContractAddress,
user: request.user.id,
amountSftmx: request.amount,
isWithdrawn: request.isWithdrawn,
Expand Down
14 changes: 14 additions & 0 deletions prisma/migrations/20231221141943_adapt_sftmx_schema/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
Warnings:
- Added the required column `ftmStakingId` to the `PrismaSftmxWithdrawalRequest` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "PrismaSftmxWithdrawalRequest" DROP CONSTRAINT "PrismaSftmxWithdrawalRequest_id_fkey";

-- AlterTable
ALTER TABLE "PrismaSftmxWithdrawalRequest" ADD COLUMN "ftmStakingId" TEXT NOT NULL;

-- AddForeignKey
ALTER TABLE "PrismaSftmxWithdrawalRequest" ADD CONSTRAINT "PrismaSftmxWithdrawalRequest_ftmStakingId_fkey" FOREIGN KEY ("ftmStakingId") REFERENCES "PrismaSftmxStakingData"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
11 changes: 6 additions & 5 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,13 @@ model PrismaSftmxStakingData {

model PrismaSftmxWithdrawalRequest {
id String @id
ftmStakingId PrismaSftmxStakingData @relation(fields:[id], references: [id])
ftmStakingId String
ftmStaking PrismaSftmxStakingData @relation(fields:[ftmStakingId], references: [id])
user String
amountSftmx String
requestTimestamp Int
isWithdrawn Boolean
user String
amountSftmx String
requestTimestamp Int
isWithdrawn Boolean
}


Expand Down

0 comments on commit d50bb7d

Please sign in to comment.