Добавлена ДБ
This commit is contained in:
62
ospabhost/prisma/schema.prisma
Normal file
62
ospabhost/prisma/schema.prisma
Normal file
@@ -0,0 +1,62 @@
|
||||
// prisma/schema.prisma
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL") // подключение через .env
|
||||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
email String @unique
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
servers Server[]
|
||||
subscriptions Subscription[]
|
||||
payments Payment[] // <- добавлено поле для платежей
|
||||
}
|
||||
|
||||
model Server {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
vmId Int
|
||||
userId Int
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
}
|
||||
|
||||
model Plan {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
price Float
|
||||
description String?
|
||||
subscriptions Subscription[]
|
||||
}
|
||||
|
||||
model Subscription {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
planId Int
|
||||
status String @default("active")
|
||||
startedAt DateTime @default(now())
|
||||
expiresAt DateTime?
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
plan Plan @relation(fields: [planId], references: [id])
|
||||
}
|
||||
|
||||
model Payment {
|
||||
id Int @id @default(autoincrement())
|
||||
userId Int
|
||||
amount Float
|
||||
status String @default("pending")
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
}
|
||||
Reference in New Issue
Block a user