Merge pull request #2062 from Dokploy/fix/migration-git-permissions

refactor(git_provider): update userId assignment to use owner_id from…
This commit is contained in:
Mauricio Siu 2025-06-22 08:57:10 +02:00 committed by GitHub
commit 274daf52c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,12 +1,11 @@
ALTER TABLE "git_provider" ADD COLUMN "userId" text;--> statement-breakpoint
-- Update existing git providers to be owned by the organization owner
-- We need to get the account.user_id for the organization owner
-- We can get the owner_id directly from the organization table
UPDATE "git_provider"
SET "userId" = (
SELECT a.user_id
SELECT o."owner_id"
FROM "organization" o
JOIN "account" a ON o."owner_id" = a.user_id
WHERE o.id = "git_provider"."organizationId"
);--> statement-breakpoint