Files
dokploy/apps/dokploy/drizzle/0153_motionless_mastermind.sql
Mauricio Siu c752cf3f9e feat(libsql): implement libsql service schema and update related components
- Created a new SQL type for 'libsql' and established a corresponding table with necessary fields and constraints.
- Updated existing tables (backup, mount, volume_backup) to include foreign key references to 'libsql'.
- Enhanced the libsql schema in the application to support additional fields such as stopGracePeriodSwarm and endpointSpecSwarm.
- Adjusted form handling and validation to accommodate the new libsql service type, improving overall integration and functionality.
2026-03-23 21:51:02 -06:00

49 lines
2.5 KiB
SQL

CREATE TYPE "public"."sqldNode" AS ENUM('primary', 'replica');--> statement-breakpoint
ALTER TYPE "public"."databaseType" ADD VALUE 'libsql';--> statement-breakpoint
ALTER TYPE "public"."serviceType" ADD VALUE 'libsql';--> statement-breakpoint
CREATE TABLE "libsql" (
"libsqlId" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"appName" text NOT NULL,
"description" text,
"databaseUser" text NOT NULL,
"databasePassword" text NOT NULL,
"sqldNode" "sqldNode" DEFAULT 'primary' NOT NULL,
"sqldPrimaryUrl" text,
"enableNamespaces" boolean DEFAULT false NOT NULL,
"dockerImage" text NOT NULL,
"command" text,
"env" text,
"memoryReservation" text,
"memoryLimit" text,
"cpuReservation" text,
"cpuLimit" text,
"externalPort" integer,
"externalGRPCPort" integer,
"externalAdminPort" integer,
"applicationStatus" "applicationStatus" DEFAULT 'idle' NOT NULL,
"healthCheckSwarm" json,
"restartPolicySwarm" json,
"placementSwarm" json,
"updateConfigSwarm" json,
"rollbackConfigSwarm" json,
"modeSwarm" json,
"labelsSwarm" json,
"networkSwarm" json,
"stopGracePeriodSwarm" bigint,
"endpointSpecSwarm" json,
"replicas" integer DEFAULT 1 NOT NULL,
"createdAt" text NOT NULL,
"environmentId" text NOT NULL,
"serverId" text,
CONSTRAINT "libsql_appName_unique" UNIQUE("appName")
);
--> statement-breakpoint
ALTER TABLE "backup" ADD COLUMN "libsqlId" text;--> statement-breakpoint
ALTER TABLE "mount" ADD COLUMN "libsqlId" text;--> statement-breakpoint
ALTER TABLE "volume_backup" ADD COLUMN "libsqlId" text;--> statement-breakpoint
ALTER TABLE "libsql" ADD CONSTRAINT "libsql_environmentId_environment_environmentId_fk" FOREIGN KEY ("environmentId") REFERENCES "public"."environment"("environmentId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "libsql" ADD CONSTRAINT "libsql_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "backup" ADD CONSTRAINT "backup_libsqlId_libsql_libsqlId_fk" FOREIGN KEY ("libsqlId") REFERENCES "public"."libsql"("libsqlId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "mount" ADD CONSTRAINT "mount_libsqlId_libsql_libsqlId_fk" FOREIGN KEY ("libsqlId") REFERENCES "public"."libsql"("libsqlId") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "volume_backup" ADD CONSTRAINT "volume_backup_libsqlId_libsql_libsqlId_fk" FOREIGN KEY ("libsqlId") REFERENCES "public"."libsql"("libsqlId") ON DELETE cascade ON UPDATE no action;