Skip to content

Commit

Permalink
Scout telegram user
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinludu committed Nov 6, 2024
1 parent 9106321 commit 04615a7
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- CreateTable
CREATE TABLE "ScoutTelegramUser" (
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"scoutId" UUID NOT NULL,
"telegramId" BIGINT NOT NULL,
"username" TEXT NOT NULL,
"avatar" TEXT,

CONSTRAINT "ScoutTelegramUser_pkey" PRIMARY KEY ("telegramId")
);

-- CreateIndex
CREATE UNIQUE INDEX "ScoutTelegramUser_scoutId_key" ON "ScoutTelegramUser"("scoutId");

-- CreateIndex
CREATE INDEX "ScoutTelegramUser_telegramId_idx" ON "ScoutTelegramUser"("telegramId");

-- CreateIndex
CREATE INDEX "ScoutTelegramUser_scoutId_idx" ON "ScoutTelegramUser"("scoutId");

-- AddForeignKey
ALTER TABLE "ScoutTelegramUser" ADD CONSTRAINT "ScoutTelegramUser_scoutId_fkey" FOREIGN KEY ("scoutId") REFERENCES "Scout"("id") ON DELETE CASCADE ON UPDATE CASCADE;
14 changes: 14 additions & 0 deletions src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,7 @@ model Scout {
agreedToTermsAt DateTime?
onboardedAt DateTime?
currentBalance Int @default(0)
telegramUser ScoutTelegramUser?
scoutWallet ScoutWallet[]
strikes BuilderStrike[]
events BuilderEvent[]
Expand Down Expand Up @@ -3178,3 +3179,16 @@ model ScoutWallet {
@@index([address])
@@index([scoutId])
}

model ScoutTelegramUser {
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
scoutId String @unique @db.Uuid
telegramId BigInt @id
username String
avatar String?
scout Scout @relation(fields: [scoutId], references: [id], onDelete: Cascade)
@@index([telegramId])
@@index([scoutId])
}

0 comments on commit 04615a7

Please sign in to comment.