fantecy
This commit is contained in:
26
prisma/login-news-manual.sql
Normal file
26
prisma/login-news-manual.sql
Normal 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");
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user