feat(rollbacks): enhance fullContext type and refactor createRollback logic

- Updated fullContext type in rollbacks schema to include Application and Project types.
- Refactored createRollback function to separate fullContext from input and handle it more efficiently.
- Integrated environment variable preparation into the rollback process.
This commit is contained in:
Mauricio Siu
2025-06-22 09:56:36 -06:00
parent 892f272108
commit 24bff96898
2 changed files with 15 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ import { createInsertSchema } from "drizzle-zod";
import { nanoid } from "nanoid";
import { z } from "zod";
import { deployments } from "./deployment";
import type { Application } from "@dokploy/server/services/application";
import type { Project } from "@dokploy/server/services/project";
export const rollbacks = pgTable("rollback", {
rollbackId: text("rollbackId")
@@ -20,7 +22,7 @@ export const rollbacks = pgTable("rollback", {
createdAt: text("createdAt")
.notNull()
.$defaultFn(() => new Date().toISOString()),
fullContext: jsonb("fullContext"),
fullContext: jsonb("fullContext").$type<Application & { project: Project }>(),
});
export type Rollback = typeof rollbacks.$inferSelect;