Files
portabase/prisma/schema.prisma
T

223 lines
6.9 KiB
Plaintext
Raw Normal View History

2024-12-17 20:24:11 +01:00
//////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT MODIFY THIS FILE //
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
//////////////////////////////////////////////////////////////////////////////////////////////
2024-11-03 11:49:04 +01:00
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
2024-12-17 20:24:11 +01:00
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "debian-openssl-3.0.x"]
}
enum Role {
pending
user
admin
}
enum Dbms {
postgresql
mysql
mongodb
}
enum Status {
waiting
ongoing
failed
success
}
enum TypeStorage {
local
s3
}
2024-11-03 11:49:04 +01:00
model Account {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
userId String @map("user_id")
2024-11-03 11:49:04 +01:00
type String
provider String
2024-12-17 20:24:11 +01:00
providerAccountId String @map("provider_account_id")
refresh_token String? @db.Text()
access_token String? @db.Text()
2024-11-03 11:49:04 +01:00
expires_at Int?
token_type String?
scope String?
2024-12-17 20:24:11 +01:00
id_token String? @db.Text()
2024-11-03 11:49:04 +01:00
session_state String?
2024-12-17 20:24:11 +01:00
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
2024-11-03 11:49:04 +01:00
@@unique([provider, providerAccountId])
@@map("accounts")
}
model Session {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
sessionToken String @unique() @map("session_token")
userId String @map("user_id")
2024-11-03 11:49:04 +01:00
expires DateTime
2024-12-17 20:24:11 +01:00
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
2024-11-03 11:49:04 +01:00
@@map("sessions")
}
model VerificationToken {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
2024-11-03 11:49:04 +01:00
identifier String
token String
expires DateTime
@@unique([identifier, token])
@@map("verificationtokens")
}
model User {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
2024-11-03 11:49:04 +01:00
name String?
2024-12-17 20:24:11 +01:00
email String? @unique()
2024-12-12 13:31:11 +01:00
emailVerified DateTime? @map("email_verified")
2024-11-03 11:49:04 +01:00
image String?
2024-11-23 16:05:00 +01:00
role Role
2024-11-03 21:12:40 +01:00
password String?
2024-12-12 13:31:11 +01:00
authMethod String? @map("auth_method")
deleted Boolean? @default(false)
2024-11-17 21:01:05 +01:00
accounts Account[]
sessions Session[]
2024-12-12 13:31:11 +01:00
organizations UserOrganization[]
2024-11-03 11:49:04 +01:00
@@map("users")
}
2024-11-10 23:12:38 +01:00
2024-11-29 12:39:50 +01:00
model Organization {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
slug String @unique()
2024-11-29 12:39:50 +01:00
name String
2024-12-17 20:24:11 +01:00
projects Project[]
users UserOrganization[]
2024-12-29 19:34:48 +01:00
deleted Boolean? @default(false)
2024-11-29 12:39:50 +01:00
@@map("organizations")
}
2024-12-12 13:31:11 +01:00
model UserOrganization {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
2024-12-12 13:31:11 +01:00
userId String
organizationId String
user User @relation(fields: [userId], references: [id])
organization Organization @relation(fields: [organizationId], references: [id])
@@unique([userId, organizationId])
@@map("users_organisations")
}
2024-11-29 12:39:50 +01:00
model Project {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
slug String @unique()
name String
2024-12-17 20:32:23 +01:00
isArchived Boolean @default(false) @map("is_archived")
2024-11-29 12:39:50 +01:00
organizationId String @map("organization_id")
organization Organization @relation(fields: [organizationId], references: [id])
2024-12-17 20:24:11 +01:00
databases Database[]
2024-11-29 12:39:50 +01:00
@@map("projects")
}
2024-11-10 23:12:38 +01:00
model Agent {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
slug String @unique()
2024-11-10 23:12:38 +01:00
name String
description String?
2024-12-17 20:24:11 +01:00
lastContact DateTime? @map("last_contact")
databases Database[]
2024-11-17 19:13:51 +01:00
@@map("agents")
}
2024-11-10 23:12:38 +01:00
model Database {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
name String
dbms Dbms
2024-12-17 20:24:11 +01:00
generatedId String @unique()
description String?
2024-12-17 20:24:11 +01:00
backupPolicy String? @map("backup_policy")
isWaitingForBackup Boolean? @default(false)
backupToRestore String?
2024-12-17 20:24:11 +01:00
agentId String @map("agent_id")
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
lastContact DateTime? @map("last_contact")
backups Backup[]
restorations Restoration[]
projectId String? @map("project_id")
project Project? @relation(fields: [projectId], references: [id])
2024-11-29 12:39:50 +01:00
2024-11-17 19:13:51 +01:00
@@map("databases")
2024-11-10 23:12:38 +01:00
}
model Backup {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
status Status @default(waiting)
file String?
databaseId String @map("database_id")
database Database @relation(fields: [databaseId], references: [id], onDelete: Cascade)
2024-12-14 17:52:10 +01:00
restorations Restoration[]
2024-11-17 19:13:51 +01:00
@@map("backups")
2024-11-10 23:12:38 +01:00
}
2024-12-14 17:52:10 +01:00
model Restoration {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
status Status @default(waiting)
backupId String @map("backup_id")
backup Backup @relation(fields: [backupId], references: [id], onDelete: Cascade)
2024-11-11 19:12:34 +01:00
databaseId String? @map("database_id")
database Database? @relation(fields: [databaseId], references: [id], onDelete: Cascade)
2024-11-17 19:13:51 +01:00
2024-12-14 17:52:10 +01:00
@@map("restorations")
2024-11-10 23:12:38 +01:00
}
2024-11-13 19:45:22 +01:00
model Settings {
2024-12-17 20:24:11 +01:00
id String @id() @default(cuid())
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime? @updatedAt() @map("updated_at")
2024-11-13 19:45:22 +01:00
storage TypeStorage @default(local)
2024-12-17 20:24:11 +01:00
name String @unique()
2024-11-16 17:05:55 +01:00
s3EndPointUrl String?
2024-11-13 19:45:22 +01:00
s3AccessKeyId String?
s3SecretAccessKey String?
S3BucketName String?
2024-11-16 17:05:55 +01:00
smtpPassword String?
smtpFrom String?
smtpHost String?
smtpPort String?
smtpUser String?
2024-11-17 19:13:51 +01:00
@@map("settings")
2024-11-13 19:45:22 +01:00
}