67 lines
1.7 KiB
Plaintext
67 lines
1.7 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
output = "../generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
|
}
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
transactions Transaction[]
|
|
wallets Wallet[]
|
|
categories Category[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Wallet {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
name String
|
|
kind String @default("money")
|
|
currency String?
|
|
unit String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
deletedAt DateTime?
|
|
transactions Transaction[]
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("wallets")
|
|
}
|
|
|
|
model Category {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@unique([userId, name])
|
|
@@map("categories")
|
|
}
|
|
|
|
model Transaction {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
walletId String
|
|
amount Float
|
|
direction String
|
|
date DateTime @default(now())
|
|
category String?
|
|
memo String?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
wallet Wallet @relation(fields: [walletId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("transactions")
|
|
}
|