mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
adding zenstack.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- The required column `id` was added to the `verificationtokens` table with a prisma-level default value. This is not possible if the table is not empty. Please add this column as optional, then populate it before making it required.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "accounts" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "agents" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "backups" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "databases" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "organizations" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "projects" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "restorations" ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "sessions" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "settings" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "users_organisations" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updated_at" TIMESTAMP(3);
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "verificationtokens" ADD COLUMN "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "id" TEXT NOT NULL,
|
||||
ADD COLUMN "updated_at" TIMESTAMP(3),
|
||||
ADD CONSTRAINT "verificationtokens_pkey" PRIMARY KEY ("id");
|
||||
+106
-102
@@ -1,50 +1,79 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl-openssl-3.0.x", "debian-openssl-3.0.x"]
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DO NOT MODIFY THIS FILE //
|
||||
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String @map("user_id")
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
userId String @map("user_id")
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String @map("provider_account_id")
|
||||
refresh_token String? @db.Text
|
||||
access_token String? @db.Text
|
||||
providerAccountId String @map("provider_account_id")
|
||||
refresh_token String? @db.Text()
|
||||
access_token String? @db.Text()
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? @db.Text
|
||||
id_token String? @db.Text()
|
||||
session_state String?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
@@map("accounts")
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique @map("session_token")
|
||||
userId String @map("user_id")
|
||||
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")
|
||||
expires DateTime
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("sessions")
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
identifier String
|
||||
token String
|
||||
expires DateTime
|
||||
@@ -54,16 +83,16 @@ model VerificationToken {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(cuid())
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
name String?
|
||||
email String? @unique
|
||||
email String? @unique()
|
||||
emailVerified DateTime? @map("email_verified")
|
||||
image String?
|
||||
role Role
|
||||
password String?
|
||||
authMethod String? @map("auth_method")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt @map("updated_at")
|
||||
deleted Boolean? @default(false)
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
@@ -72,26 +101,22 @@ model User {
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
pending
|
||||
user
|
||||
admin
|
||||
}
|
||||
|
||||
model Organization {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
slug String @unique()
|
||||
name String
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
projects Project[]
|
||||
users UserOrganization[]
|
||||
projects Project[]
|
||||
users UserOrganization[]
|
||||
|
||||
@@map("organizations")
|
||||
}
|
||||
|
||||
model UserOrganization {
|
||||
id String @id @default(cuid())
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
userId String
|
||||
organizationId String
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
@@ -102,106 +127,85 @@ model UserOrganization {
|
||||
}
|
||||
|
||||
model Project {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique
|
||||
name String
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
slug String @unique()
|
||||
name String
|
||||
organizationId String @map("organization_id")
|
||||
organization Organization @relation(fields: [organizationId], references: [id])
|
||||
|
||||
databases Database[]
|
||||
databases Database[]
|
||||
|
||||
@@map("projects")
|
||||
}
|
||||
|
||||
model Agent {
|
||||
id String @id @default(cuid())
|
||||
slug String @unique
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
slug String @unique()
|
||||
name String
|
||||
description String?
|
||||
lastContact DateTime? @map("last_contact")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
databases Database[]
|
||||
lastContact DateTime? @map("last_contact")
|
||||
databases Database[]
|
||||
|
||||
@@map("agents")
|
||||
}
|
||||
|
||||
enum Dbms {
|
||||
postgresql
|
||||
mysql
|
||||
mongodb
|
||||
}
|
||||
|
||||
model Database {
|
||||
id String @id @default(cuid())
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
name String
|
||||
dbms Dbms
|
||||
generatedId String @unique
|
||||
generatedId String @unique()
|
||||
description String?
|
||||
backupPolicy String? @map("backup_policy")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
isWaitingForBackup Boolean? @default(false)
|
||||
backupPolicy String? @map("backup_policy")
|
||||
isWaitingForBackup Boolean? @default(false)
|
||||
backupToRestore String?
|
||||
|
||||
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])
|
||||
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])
|
||||
|
||||
@@map("databases")
|
||||
}
|
||||
|
||||
enum Status {
|
||||
waiting
|
||||
ongoing
|
||||
failed
|
||||
success
|
||||
}
|
||||
|
||||
model Backup {
|
||||
id String @id @default(cuid())
|
||||
status Status @default(waiting)
|
||||
file String?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
databaseId String @map("database_id")
|
||||
database Database @relation(fields: [databaseId], references: [id], onDelete: Cascade)
|
||||
|
||||
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)
|
||||
restorations Restoration[]
|
||||
|
||||
@@map("backups")
|
||||
}
|
||||
|
||||
model Restoration {
|
||||
id String @id @default(cuid())
|
||||
status Status @default(waiting)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
backupId String @map("backup_id")
|
||||
backup Backup @relation(fields: [backupId], references: [id], onDelete: Cascade)
|
||||
|
||||
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)
|
||||
databaseId String? @map("database_id")
|
||||
database Database? @relation(fields: [databaseId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("restorations")
|
||||
}
|
||||
|
||||
enum TypeStorage {
|
||||
local
|
||||
s3
|
||||
}
|
||||
|
||||
model Settings {
|
||||
id String @id @default(cuid())
|
||||
id String @id() @default(cuid())
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime? @updatedAt() @map("updated_at")
|
||||
storage TypeStorage @default(local)
|
||||
name String @unique
|
||||
name String @unique()
|
||||
s3EndPointUrl String?
|
||||
s3AccessKeyId String?
|
||||
s3SecretAccessKey String?
|
||||
|
||||
Reference in New Issue
Block a user