Skip to content

Commit da52d76

Browse files
committed
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.
1 parent 45a178e commit da52d76

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

apps/dokploy/drizzle/0094_numerous_carmella_unuscione.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
ALTER TABLE "git_provider" ADD COLUMN "userId" text;--> statement-breakpoint
22

33
-- Update existing git providers to be owned by the organization owner
4-
-- We need to get the account.user_id for the organization owner
4+
-- We can get the owner_id directly from the organization table
55
UPDATE "git_provider"
66
SET "userId" = (
7-
SELECT a.user_id
7+
SELECT o."owner_id"
88
FROM "organization" o
9-
JOIN "account" a ON o."owner_id" = a.user_id
109
WHERE o.id = "git_provider"."organizationId"
1110
);--> statement-breakpoint
1211

0 commit comments

Comments
 (0)