mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-04 19:22:16 +00:00
feat: add preview deployments #379
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { relations } from "drizzle-orm";
|
||||
import {
|
||||
type AnyPgColumn,
|
||||
boolean,
|
||||
integer,
|
||||
pgEnum,
|
||||
@@ -14,8 +15,13 @@ import { domain } from "../validations/domain";
|
||||
import { applications } from "./application";
|
||||
import { compose } from "./compose";
|
||||
import { certificateType } from "./shared";
|
||||
import { previewDeployments } from "./preview-deployments";
|
||||
|
||||
export const domainType = pgEnum("domainType", ["compose", "application"]);
|
||||
export const domainType = pgEnum("domainType", [
|
||||
"compose",
|
||||
"application",
|
||||
"preview",
|
||||
]);
|
||||
|
||||
export const domains = pgTable("domain", {
|
||||
domainId: text("domainId")
|
||||
@@ -28,6 +34,7 @@ export const domains = pgTable("domain", {
|
||||
path: text("path").default("/"),
|
||||
serviceName: text("serviceName"),
|
||||
domainType: domainType("domainType").default("application"),
|
||||
isPreviewDeployment: boolean("isPreviewDeployment").default(false), // TODO: remove
|
||||
uniqueConfigKey: serial("uniqueConfigKey"),
|
||||
createdAt: text("createdAt")
|
||||
.notNull()
|
||||
@@ -39,6 +46,10 @@ export const domains = pgTable("domain", {
|
||||
() => applications.applicationId,
|
||||
{ onDelete: "cascade" },
|
||||
),
|
||||
previewDeploymentId: text("previewDeploymentId").references(
|
||||
(): AnyPgColumn => previewDeployments.previewDeploymentId,
|
||||
{ onDelete: "cascade" },
|
||||
),
|
||||
certificateType: certificateType("certificateType").notNull().default("none"),
|
||||
});
|
||||
|
||||
@@ -51,6 +62,10 @@ export const domainsRelations = relations(domains, ({ one }) => ({
|
||||
fields: [domains.composeId],
|
||||
references: [compose.composeId],
|
||||
}),
|
||||
previewDeployment: one(previewDeployments, {
|
||||
fields: [domains.previewDeploymentId],
|
||||
references: [previewDeployments.previewDeploymentId],
|
||||
}),
|
||||
}));
|
||||
|
||||
const createSchema = createInsertSchema(domains, domain._def.schema.shape);
|
||||
@@ -65,6 +80,7 @@ export const apiCreateDomain = createSchema.pick({
|
||||
composeId: true,
|
||||
serviceName: true,
|
||||
domainType: true,
|
||||
previewDeploymentId: true,
|
||||
});
|
||||
|
||||
export const apiFindDomain = createSchema
|
||||
|
||||
Reference in New Issue
Block a user