mirror of
https://github.com/EdiFarcas/Giveaway-app.git
synced 2026-06-22 05:00:55 +03:00
84 lines
2.1 KiB
Plaintext
84 lines
2.1 KiB
Plaintext
datasource db {
|
|
provider = "postgresql" // Or your database provider
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
name String?
|
|
email String? @unique
|
|
emailVerified DateTime?
|
|
image String?
|
|
accounts Account[]
|
|
sessions Session[]
|
|
youtubeUsername String? @unique
|
|
youtubeHandle String? @unique
|
|
youtubeChannelId String? @unique
|
|
coins Int @default(0)
|
|
entries Entry[]
|
|
}
|
|
|
|
model Account {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
type String
|
|
provider String
|
|
providerAccountId String
|
|
refresh_token String? // Optional
|
|
access_token String? // Optional
|
|
expires_at Int? // Optional
|
|
token_type String? // Optional
|
|
scope String? // Optional
|
|
id_token String? // Optional
|
|
session_state String? // Optional
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([provider, providerAccountId])
|
|
}
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
sessionToken String @unique
|
|
userId String
|
|
expires DateTime
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
}
|
|
|
|
model VerificationToken {
|
|
identifier String
|
|
token String @unique
|
|
expires DateTime
|
|
|
|
@@unique([identifier, token])
|
|
}
|
|
|
|
model Giveaway {
|
|
id String @id @default(cuid())
|
|
title String
|
|
description String
|
|
value Int @default(0)
|
|
prize String
|
|
active Boolean @default(true)
|
|
createdAt DateTime @default(now())
|
|
duration Int?
|
|
endsAt DateTime?
|
|
entryCost Int @default(7000000)
|
|
entries Entry[]
|
|
}
|
|
|
|
model Entry {
|
|
id String @id @default(cuid())
|
|
user User @relation(fields: [userId], references: [id])
|
|
userId String
|
|
giveaway Giveaway @relation(fields: [giveawayId], references: [id])
|
|
giveawayId String
|
|
acive Boolean @default(true)
|
|
pastValue Int @default(0)
|
|
}
|