mirror of
https://github.com/LukeHagar/dokploy.git
synced 2025-12-10 20:37:45 +00:00
feat(environment): implement environment management with create, duplicate, and delete functionalities; add environment schema and database migrations
This commit is contained in:
@@ -4,6 +4,7 @@ import { createInsertSchema } from "drizzle-zod";
|
||||
import { nanoid } from "nanoid";
|
||||
import { z } from "zod";
|
||||
import { backups } from "./backups";
|
||||
import { environments } from "./environment";
|
||||
import { mounts } from "./mount";
|
||||
import { projects } from "./project";
|
||||
import { server } from "./server";
|
||||
@@ -67,6 +68,9 @@ export const postgres = pgTable("postgres", {
|
||||
projectId: text("projectId")
|
||||
.notNull()
|
||||
.references(() => projects.projectId, { onDelete: "cascade" }),
|
||||
environmentId: text("environmentId")
|
||||
.notNull()
|
||||
.references(() => environments.environmentId, { onDelete: "cascade" }),
|
||||
serverId: text("serverId").references(() => server.serverId, {
|
||||
onDelete: "cascade",
|
||||
}),
|
||||
@@ -77,6 +81,10 @@ export const postgresRelations = relations(postgres, ({ one, many }) => ({
|
||||
fields: [postgres.projectId],
|
||||
references: [projects.projectId],
|
||||
}),
|
||||
environment: one(environments, {
|
||||
fields: [postgres.environmentId],
|
||||
references: [environments.environmentId],
|
||||
}),
|
||||
backups: many(backups),
|
||||
mounts: many(mounts),
|
||||
server: one(server, {
|
||||
@@ -105,6 +113,7 @@ const createSchema = createInsertSchema(postgres, {
|
||||
cpuReservation: z.string().optional(),
|
||||
cpuLimit: z.string().optional(),
|
||||
projectId: z.string(),
|
||||
environmentId: z.string(),
|
||||
applicationStatus: z.enum(["idle", "running", "done", "error"]),
|
||||
externalPort: z.number(),
|
||||
createdAt: z.string(),
|
||||
@@ -129,6 +138,7 @@ export const apiCreatePostgres = createSchema
|
||||
databasePassword: true,
|
||||
dockerImage: true,
|
||||
projectId: true,
|
||||
environmentId: true,
|
||||
description: true,
|
||||
serverId: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user