Skip to content

Commit 72974e0

Browse files
authored
Merge pull request #4028 from Dokploy/4024-api-keys-not-working-and-unbale-to-generate-new-ones-after-upgrade-to-0287
feat: update apikey schema and relationships
2 parents 9067452 + d96e2bb commit 72974e0

9 files changed

Lines changed: 15483 additions & 9 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE "apikey" ALTER COLUMN "user_id" DROP NOT NULL;--> statement-breakpoint
2+
ALTER TABLE "apikey" ADD COLUMN "config_id" text DEFAULT 'default' NOT NULL;--> statement-breakpoint
3+
ALTER TABLE "apikey" ADD COLUMN "reference_id" text;--> statement-breakpoint
4+
UPDATE "apikey" SET "reference_id" = "user_id" WHERE "reference_id" IS NULL;--> statement-breakpoint
5+
ALTER TABLE "apikey" ALTER COLUMN "reference_id" SET NOT NULL;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ALTER TABLE "apikey" DROP CONSTRAINT "apikey_user_id_user_id_fk";
2+
--> statement-breakpoint
3+
ALTER TABLE "apikey" ADD CONSTRAINT "apikey_reference_id_user_id_fk" FOREIGN KEY ("reference_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
4+
ALTER TABLE "apikey" DROP COLUMN "user_id";

0 commit comments

Comments
 (0)