-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proper relationship from org to user
In preparation for removing userId from user to avoid duplicate users, we are ensuring that the lookup from orgs to users is using a proper id
- Loading branch information
Showing
4 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
prisma/migrations/20241016225558_add_user_to_sfdc_org/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ADD COLUMN "lastLoggedIn" TIMESTAMP(3); | ||
|
||
-- AlterTable | ||
ALTER TABLE "salesforce_org" ADD COLUMN "jetstreamUserId2" UUID; | ||
|
||
UPDATE salesforce_org | ||
SET "jetstreamUserId2" = u.id | ||
FROM "User" u | ||
WHERE salesforce_org."jetstreamUserId" = u."userId"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "salesforce_org" ADD CONSTRAINT "salesforce_org_jetstreamUserId2_fkey" FOREIGN KEY ("jetstreamUserId2") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters