mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-20 15:35:23 +00:00
f8baf6fe41
- Introduced a new "fullContext" JSONB column in the "rollback" table to store additional context for rollbacks. - Removed the "env" column from the "rollback" table to streamline data management. - Updated the rollbacks service to handle the new "fullContext" field during rollback creation. - Adjusted the application service to eliminate environment variable handling in rollback operations.
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { relations } from "drizzle-orm";
|
|
import { jsonb, pgTable, serial, text } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema } from "drizzle-zod";
|
|
import { nanoid } from "nanoid";
|
|
import { z } from "zod";
|
|
import { deployments } from "./deployment";
|
|
|
|
export const rollbacks = pgTable("rollback", {
|
|
rollbackId: text("rollbackId")
|
|
.notNull()
|
|
.primaryKey()
|
|
.$defaultFn(() => nanoid()),
|
|
deploymentId: text("deploymentId")
|
|
.notNull()
|
|
.references(() => deployments.deploymentId, {
|
|
onDelete: "cascade",
|
|
}),
|
|
version: serial(),
|
|
image: text("image"),
|
|
createdAt: text("createdAt")
|
|
.notNull()
|
|
.$defaultFn(() => new Date().toISOString()),
|
|
fullContext: jsonb("fullContext"),
|
|
});
|
|
|
|
export type Rollback = typeof rollbacks.$inferSelect;
|
|
|
|
export const rollbacksRelations = relations(rollbacks, ({ one }) => ({
|
|
deployment: one(deployments, {
|
|
fields: [rollbacks.deploymentId],
|
|
references: [deployments.deploymentId],
|
|
}),
|
|
}));
|
|
|
|
export const createRollbackSchema = createInsertSchema(rollbacks).extend({
|
|
appName: z.string().min(1),
|
|
});
|
|
|
|
export const updateRollbackSchema = createRollbackSchema.extend({
|
|
rollbackId: z.string().min(1),
|
|
});
|
|
|
|
export const apiFindOneRollback = z.object({
|
|
rollbackId: z.string().min(1),
|
|
});
|