added example schema and project site

This commit is contained in:
biersoeckli
2024-10-21 10:29:06 +00:00
parent 193a6f3ee8
commit 7c69cc09be
24 changed files with 543 additions and 92 deletions

View File

@@ -0,0 +1,52 @@
-- CreateTable
CREATE TABLE "Project" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- CreateTable
CREATE TABLE "App" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"projectId" TEXT NOT NULL,
"gitUrl" TEXT NOT NULL,
"gitBranch" TEXT NOT NULL,
"gitUsername" TEXT,
"gitToken" TEXT,
"dockerfilePath" TEXT NOT NULL DEFAULT './Dockerfile',
"replicas" INTEGER NOT NULL DEFAULT 1,
"envVars" TEXT NOT NULL,
"memoryReservation" INTEGER,
"memoryLimit" INTEGER,
"cpuReservation" INTEGER,
"cpuLimit" INTEGER,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "App_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "AppDomain" (
"hostname" TEXT NOT NULL,
"port" INTEGER NOT NULL,
"useSsl" BOOLEAN NOT NULL DEFAULT true,
"appId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
PRIMARY KEY ("hostname", "appId"),
CONSTRAINT "AppDomain_appId_fkey" FOREIGN KEY ("appId") REFERENCES "App" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "AppVolume" (
"containerMountPath" TEXT NOT NULL,
"appId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
PRIMARY KEY ("containerMountPath", "appId"),
CONSTRAINT "AppVolume_appId_fkey" FOREIGN KEY ("appId") REFERENCES "App" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

View File

@@ -111,3 +111,63 @@ model Authenticator {
}
// *** FROM HERE CUSTOM CLASSES
model Project {
id String @id @default(uuid())
name String
apps App[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model App {
id String @id @default(uuid())
name String
projectId String
project Project @relation(fields: [projectId], references: [id])
gitUrl String
gitBranch String
gitUsername String?
gitToken String?
dockerfilePath String @default("./Dockerfile")
replicas Int @default(1)
envVars String
memoryReservation Int?
memoryLimit Int?
cpuReservation Int?
cpuLimit Int?
appDomains AppDomain[]
appVolumes AppVolume[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model AppDomain {
hostname String
port Int
useSsl Boolean @default(true)
appId String
app App @relation(fields: [appId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@id([hostname, appId])
}
model AppVolume {
containerMountPath String
appId String
app App @relation(fields: [appId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@id([containerMountPath, appId])
}