2021-03-25 19:29:24 +00:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
model User {
|
2021-05-12 23:04:19 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
2021-05-22 00:09:11 +00:00
|
|
|
updatedAt DateTime @default(now()) @updatedAt @map(name: "updated_at")
|
2021-05-21 19:34:40 +00:00
|
|
|
name String @unique
|
2021-05-12 23:04:19 +00:00
|
|
|
email String? @unique
|
|
|
|
emailVerified DateTime? @map(name: "email_verified")
|
2021-03-25 19:29:24 +00:00
|
|
|
image String?
|
2021-04-12 18:05:09 +00:00
|
|
|
items Item[]
|
2021-03-25 19:29:24 +00:00
|
|
|
messages Message[]
|
2021-04-22 22:14:32 +00:00
|
|
|
votes Vote[]
|
2021-05-11 15:52:50 +00:00
|
|
|
invoices Invoice[]
|
2021-05-12 23:04:19 +00:00
|
|
|
withdrawls Withdrawl[]
|
|
|
|
msats Int @default(0)
|
2021-03-25 19:29:24 +00:00
|
|
|
|
|
|
|
@@map(name: "users")
|
|
|
|
}
|
|
|
|
|
|
|
|
model Message {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
text String
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
}
|
|
|
|
|
|
|
|
model Item {
|
2021-04-12 18:05:09 +00:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
2021-04-14 00:57:32 +00:00
|
|
|
title String?
|
2021-04-12 18:05:09 +00:00
|
|
|
text String?
|
|
|
|
url String?
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
parent Item? @relation("ParentChildren", fields: [parentId], references: [id])
|
|
|
|
parentId Int?
|
|
|
|
children Item[] @relation("ParentChildren")
|
2021-04-22 22:14:32 +00:00
|
|
|
votes Vote[]
|
2021-04-12 18:05:09 +00:00
|
|
|
path Unsupported("LTREE")?
|
2021-03-25 19:29:24 +00:00
|
|
|
|
|
|
|
@@index([userId])
|
|
|
|
@@index([parentId])
|
|
|
|
}
|
|
|
|
|
2021-04-22 22:14:32 +00:00
|
|
|
model Vote {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
2021-04-26 21:55:15 +00:00
|
|
|
sats Int @default(1)
|
2021-04-27 21:30:58 +00:00
|
|
|
boost Boolean @default(false)
|
2021-04-22 22:14:32 +00:00
|
|
|
item Item @relation(fields: [itemId], references: [id])
|
|
|
|
itemId Int
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
|
|
|
|
@@index([itemId])
|
|
|
|
@@index([userId])
|
|
|
|
}
|
|
|
|
|
2021-05-11 15:52:50 +00:00
|
|
|
model Invoice {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
|
|
|
|
hash String @unique
|
|
|
|
bolt11 String
|
|
|
|
expiresAt DateTime
|
|
|
|
confirmedAt DateTime?
|
|
|
|
msatsRequested Int
|
|
|
|
msatsReceived Int?
|
|
|
|
cancelled Boolean @default(false)
|
|
|
|
|
|
|
|
@@index([userId])
|
|
|
|
}
|
|
|
|
|
2021-05-12 23:04:19 +00:00
|
|
|
enum WithdrawlStatus {
|
2021-05-13 21:19:51 +00:00
|
|
|
CONFIRMED
|
2021-05-12 23:04:19 +00:00
|
|
|
INSUFFICIENT_BALANCE
|
|
|
|
INVALID_PAYMENT
|
|
|
|
PATHFINDING_TIMEOUT
|
|
|
|
ROUTE_NOT_FOUND
|
2021-05-13 21:19:51 +00:00
|
|
|
UNKNOWN_FAILURE
|
2021-05-12 23:04:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model Withdrawl {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
|
|
user User @relation(fields: [userId], references: [id])
|
|
|
|
userId Int
|
|
|
|
|
|
|
|
hash String @unique
|
|
|
|
bolt11 String
|
|
|
|
msatsPaying Int
|
|
|
|
msatsPaid Int?
|
|
|
|
msatsFeePaying Int
|
|
|
|
msatsFeePaid Int?
|
|
|
|
|
|
|
|
status WithdrawlStatus?
|
|
|
|
|
|
|
|
@@index([userId])
|
|
|
|
}
|
|
|
|
|
2021-03-25 19:29:24 +00:00
|
|
|
model Account {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
|
|
compoundId String @unique @map(name: "compound_id")
|
|
|
|
userId Int @map(name: "user_id")
|
|
|
|
providerType String @map(name: "provider_type")
|
|
|
|
providerId String @map(name: "provider_id")
|
|
|
|
providerAccountId String @map(name: "provider_account_id")
|
|
|
|
refreshToken String? @map(name: "refresh_token")
|
|
|
|
accessToken String? @map(name: "access_token")
|
|
|
|
accessTokenExpires DateTime? @map(name: "access_token_expires")
|
|
|
|
|
|
|
|
@@index([providerAccountId])
|
|
|
|
@@index([providerId])
|
|
|
|
@@index([userId])
|
|
|
|
@@map(name: "accounts")
|
|
|
|
}
|
|
|
|
|
|
|
|
model Session {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
|
|
userId Int @map(name: "user_id")
|
|
|
|
expires DateTime
|
|
|
|
sessionToken String @unique @map(name: "session_token")
|
|
|
|
accessToken String @unique @map(name: "access_token")
|
|
|
|
|
|
|
|
@@map(name: "sessions")
|
|
|
|
}
|
|
|
|
|
|
|
|
model VerificationRequest {
|
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
createdAt DateTime @default(now()) @map(name: "created_at")
|
|
|
|
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
|
|
|
identifier String
|
|
|
|
token String @unique
|
|
|
|
expires DateTime
|
|
|
|
|
|
|
|
@@map(name: "verification_requests")
|
|
|
|
}
|