This commit is contained in:
2026-05-06 16:28:13 +03:30
parent 9c30295b4b
commit 1a6eb4307e
8 changed files with 377 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "phone" TEXT;
CREATE UNIQUE INDEX IF NOT EXISTS "User_phone_key" ON "User"("phone");
CREATE TABLE IF NOT EXISTS "LoginOtp" (
"id" TEXT NOT NULL,
"phone" TEXT NOT NULL,
"codeHash" TEXT NOT NULL,
"attempts" INTEGER NOT NULL DEFAULT 0,
"expiresAt" TIMESTAMP(3) NOT NULL,
"consumedAt" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "LoginOtp_pkey" PRIMARY KEY ("id")
);
CREATE INDEX IF NOT EXISTS "LoginOtp_phone_createdAt_idx" ON "LoginOtp"("phone", "createdAt");
CREATE TABLE IF NOT EXISTS "FantasyNews" (
"id" TEXT NOT NULL,
"icon" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"newsTime" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "FantasyNews_pkey" PRIMARY KEY ("id")
);
CREATE INDEX IF NOT EXISTS "FantasyNews_newsTime_idx" ON "FantasyNews"("newsTime");

View File

@@ -226,6 +226,7 @@ model User {
id String @id @default(cuid())
name String?
email String @unique
phone String? @unique
password String
role Role @default(USER)
createdAt DateTime @default(now())
@@ -236,6 +237,30 @@ model User {
goldenCards GoldenCard[]
}
model LoginOtp {
id String @id @default(cuid())
phone String
codeHash String
attempts Int @default(0)
expiresAt DateTime
consumedAt DateTime?
createdAt DateTime @default(now())
@@index([phone, createdAt])
}
model FantasyNews {
id String @id @default(cuid())
icon String
title String
description String @db.Text
newsTime DateTime
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([newsTime])
}
enum GoldenCardStatus {
SEALED
OPENED