Skip to content

Commit 0e81a02

Browse files
authored
Merge pull request #1385 from Dokploy/fix/migration
fix(database): ensure adminId is not null for certificates, notificat…
2 parents 5b3005e + cf3b3a2 commit 0e81a02

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

apps/dokploy/drizzle/0066_yielding_echo.sql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,15 @@ CREATE TABLE "apikey" (
147147
"metadata" text
148148
);
149149
--> statement-breakpoint
150-
ALTER TABLE "certificate" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
151-
ALTER TABLE "notification" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
152-
ALTER TABLE "ssh-key" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
153-
ALTER TABLE "git_provider" ALTER COLUMN "adminId" SET NOT NULL;--> statement-breakpoint
150+
DELETE FROM "certificate" WHERE "adminId" IS NULL;
151+
DELETE FROM "notification" WHERE "adminId" IS NULL;
152+
DELETE FROM "ssh-key" WHERE "adminId" IS NULL;
153+
DELETE FROM "git_provider" WHERE "adminId" IS NULL;
154+
155+
ALTER TABLE "certificate" ALTER COLUMN "adminId" SET NOT NULL ;--> statement-breakpoint
156+
ALTER TABLE "notification" ALTER COLUMN "adminId" SET NOT NULL ;--> statement-breakpoint
157+
ALTER TABLE "ssh-key" ALTER COLUMN "adminId" SET NOT NULL ;--> statement-breakpoint
158+
ALTER TABLE "git_provider" ALTER COLUMN "adminId" SET NOT NULL ;--> statement-breakpoint
154159
ALTER TABLE "session_temp" ADD CONSTRAINT "session_temp_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
155160
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_temp_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user_temp"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
156161
ALTER TABLE "invitation" ADD CONSTRAINT "invitation_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint

0 commit comments

Comments
 (0)