| 1 | // This is your Prisma schema file, |
| 2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema |
| 3 | |
| 4 | // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? |
| 5 | // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init |
| 6 | |
| 7 | generator client { |
| 8 | provider = "prisma-client-js" |
| 9 | } |
| 10 | |
| 11 | datasource db { |
| 12 | provider = "postgresql" |
| 13 | url = env("DATABASE_URL") |
| 14 | } |
| 15 | |
| 16 | model User { |
| 17 | id String @id @default(uuid()) |
| 18 | email String @unique |
| 19 | password String |
| 20 | createdAt DateTime @default(now()) @map("created_at") |
| 21 | updatedAt DateTime @updatedAt @map("updated_at") |
| 22 | |
| 23 | // Relations |
| 24 | refreshTokens RefreshToken[] |
| 25 | |
| 26 | @@map("users") |
| 27 | } |
| 28 | |
| 29 | model RefreshToken { |
| 30 | id String @id @default(uuid()) |
| 31 | userId String @map("user_id") |
| 32 | token String @unique |
| 33 | expiresAt DateTime @map("expires_at") |
| 34 | createdAt DateTime @default(now()) @map("created_at") |
| 35 | |
| 36 | // Relations |
| 37 | user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| 38 | |
| 39 | @@map("refresh_tokens") |
| 40 | } |