mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
- Introduced a new `schedule` table with fields for `scheduleId`, `name`, `cronExpression`, `appName`, `serviceName`, `shellType`, `scheduleType`, `command`, `script`, `applicationId`, `composeId`, `serverId`, `userId`, `enabled`, and `createdAt`. - Added ENUM types `scheduleType` and `shellType` for better data integrity. - Updated the `deployment` table to include `startedAt`, `finishedAt`, and `scheduleId` columns for enhanced tracking of deployment timing and associations. - Established foreign key constraints between `schedule` and related tables to maintain referential integrity. - Removed outdated SQL files to streamline the schema management process.
28 lines
1.9 KiB
SQL
28 lines
1.9 KiB
SQL
CREATE TYPE "public"."scheduleType" AS ENUM('application', 'compose', 'server', 'dokploy-server');--> statement-breakpoint
|
|
CREATE TYPE "public"."shellType" AS ENUM('bash', 'sh');--> statement-breakpoint
|
|
CREATE TABLE "schedule" (
|
|
"scheduleId" text PRIMARY KEY NOT NULL,
|
|
"name" text NOT NULL,
|
|
"cronExpression" text NOT NULL,
|
|
"appName" text NOT NULL,
|
|
"serviceName" text,
|
|
"shellType" "shellType" DEFAULT 'bash' NOT NULL,
|
|
"scheduleType" "scheduleType" DEFAULT 'application' NOT NULL,
|
|
"command" text NOT NULL,
|
|
"script" text,
|
|
"applicationId" text,
|
|
"composeId" text,
|
|
"serverId" text,
|
|
"userId" text,
|
|
"enabled" boolean DEFAULT true NOT NULL,
|
|
"createdAt" text NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "deployment" ADD COLUMN "startedAt" text;--> statement-breakpoint
|
|
ALTER TABLE "deployment" ADD COLUMN "finishedAt" text;--> statement-breakpoint
|
|
ALTER TABLE "deployment" ADD COLUMN "scheduleId" text;--> statement-breakpoint
|
|
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_applicationId_application_applicationId_fk" FOREIGN KEY ("applicationId") REFERENCES "public"."application"("applicationId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_composeId_compose_composeId_fk" FOREIGN KEY ("composeId") REFERENCES "public"."compose"("composeId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "deployment" ADD CONSTRAINT "deployment_scheduleId_schedule_scheduleId_fk" FOREIGN KEY ("scheduleId") REFERENCES "public"."schedule"("scheduleId") ON DELETE cascade ON UPDATE no action; |