mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(git_provider): update userId assignment to use owner_id from organization table
- Changed the SQL update statement to directly select the owner_id from the organization table instead of joining with the account table, simplifying the query.
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
ALTER TABLE "git_provider" ADD COLUMN "userId" text;--> statement-breakpoint
|
ALTER TABLE "git_provider" ADD COLUMN "userId" text;--> statement-breakpoint
|
||||||
|
|
||||||
-- Update existing git providers to be owned by the organization owner
|
-- 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"
|
UPDATE "git_provider"
|
||||||
SET "userId" = (
|
SET "userId" = (
|
||||||
SELECT a.user_id
|
SELECT o."owner_id"
|
||||||
FROM "organization" o
|
FROM "organization" o
|
||||||
JOIN "account" a ON o."owner_id" = a.user_id
|
|
||||||
WHERE o.id = "git_provider"."organizationId"
|
WHERE o.id = "git_provider"."organizationId"
|
||||||
);--> statement-breakpoint
|
);--> statement-breakpoint
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user