diff --git a/modules/sftmx/sftmx.prisma b/modules/sftmx/sftmx.prisma index c9c381e8c..6b604768b 100644 --- a/modules/sftmx/sftmx.prisma +++ b/modules/sftmx/sftmx.prisma @@ -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 } diff --git a/modules/sftmx/sftmx.service.ts b/modules/sftmx/sftmx.service.ts index 894f863d8..c7bfc4bf8 100644 --- a/modules/sftmx/sftmx.service.ts +++ b/modules/sftmx/sftmx.service.ts @@ -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, diff --git a/prisma/migrations/20231221141943_adapt_sftmx_schema/migration.sql b/prisma/migrations/20231221141943_adapt_sftmx_schema/migration.sql new file mode 100644 index 000000000..a3ab7a044 --- /dev/null +++ b/prisma/migrations/20231221141943_adapt_sftmx_schema/migration.sql @@ -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; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 211f2423f..db064d830 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -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 }