| generator client { |
| provider = "prisma-client-js" |
| } |
|
|
| datasource db { |
| provider = "sqlite" |
| url = env("DATABASE_URL") |
| } |
|
|
| model User { |
| id String @id @default(cuid()) |
| email String @unique |
| name String |
| password String |
| plan String @default("free") |
| stripeCid String? |
| apiKey String? |
| createdAt DateTime @default(now()) |
| updatedAt DateTime @updatedAt |
|
|
| sessions Session[] |
| invoices Invoice[] |
| activityLogs ActivityLog[] |
| resetTokens ResetToken[] |
| } |
|
|
| model Session { |
| id String @id @default(cuid()) |
| token String @unique |
| userId String |
| expiresAt DateTime |
| createdAt DateTime @default(now()) |
|
|
| user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| } |
|
|
| model Invoice { |
| id String @id @default(cuid()) |
| userId String |
| filename String? |
| vendor String? |
| invNumber String? |
| invDate String? |
| dueDate String? |
| amount Float? |
| vatAmount Float? |
| total Float? |
| currency String @default("USD") |
| status String @default("done") |
| isDuplicate Boolean @default(false) |
| confidence Float? |
| rawJson String? |
| createdAt DateTime @default(now()) |
| updatedAt DateTime @updatedAt |
|
|
| user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
| } |
|
|
| model RateLimit { |
| id String @id @default(cuid()) |
| key String @unique |
| count Int @default(0) |
| resetAt DateTime |
| createdAt DateTime @default(now()) |
| updatedAt DateTime @updatedAt |
| } |
|
|
| model ActivityLog { |
| id String @id @default(cuid()) |
| userId String |
| type String |
| title String |
| description String |
| metadata String? |
| createdAt DateTime @default(now()) |
| updatedAt DateTime @updatedAt |
|
|
| user User @relation(fields: [userId], references: [id], onDelete: Cascade) |
|
|
| @@index([userId]) |
| } |
|
|
| model ResetToken { |
| id String @id @default(cuid()) |
| email String |
| token String @unique |
| expiresAt DateTime |
| usedAt DateTime? |
| createdAt DateTime @default(now()) |
|
|
| user User @relation(fields: [email], references: [email], onDelete: Cascade) |
| } |