From 533043cbb785fe85ab370a8c5160b64bb2600bdf Mon Sep 17 00:00:00 2001 From: mattcasey Date: Thu, 31 Oct 2024 11:32:50 -0600 Subject: [PATCH] relate nft purchase events to scout wallet instead --- .../migration.sql | 5 +++++ src/prisma/schema.prisma | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 src/prisma/migrations/20241031173213_add_wallet_address_to_nft/migration.sql diff --git a/src/prisma/migrations/20241031173213_add_wallet_address_to_nft/migration.sql b/src/prisma/migrations/20241031173213_add_wallet_address_to_nft/migration.sql new file mode 100644 index 00000000..dcf5b4fb --- /dev/null +++ b/src/prisma/migrations/20241031173213_add_wallet_address_to_nft/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "NFTPurchaseEvent" ADD COLUMN "walletAddress" TEXT; + +-- AddForeignKey +ALTER TABLE "NFTPurchaseEvent" ADD CONSTRAINT "NFTPurchaseEvent_walletAddress_fkey" FOREIGN KEY ("walletAddress") REFERENCES "ScoutWallet"("address") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/src/prisma/schema.prisma b/src/prisma/schema.prisma index dc59ec43..27a9fa71 100644 --- a/src/prisma/schema.prisma +++ b/src/prisma/schema.prisma @@ -2948,6 +2948,8 @@ model NFTPurchaseEvent { txHash String builderEvent BuilderEvent? activities ScoutGameActivity[] + walletAddress String? + scoutWallet ScoutWallet? @relation(fields: [walletAddress], references: [address], onDelete: Cascade) @@index([scoutId]) } @@ -3167,10 +3169,11 @@ model BuilderCardActivity { } model ScoutWallet { - createdAt DateTime @default(now()) - address String @unique - scoutId String @db.Uuid - scout Scout @relation(fields: [scoutId], references: [id], onDelete: Cascade) + createdAt DateTime @default(now()) + address String @unique + scoutId String @db.Uuid + scout Scout @relation(fields: [scoutId], references: [id], onDelete: Cascade) + purchaseEvents NFTPurchaseEvent[] @@index([address]) @@index([scoutId])