forked from plandex-ai/plandex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for creating an org that auto-adds users based on email domain, f…
…ixes plandex-ai#24
- Loading branch information
Showing
6 changed files
with
35 additions
and
5 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
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
1 change: 1 addition & 0 deletions
1
app/server/migrations/2024040400_add_orgs_users_unique.down.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 @@ | ||
ALTER TABLE orgs_users DROP CONSTRAINT org_user_unique; |
12 changes: 12 additions & 0 deletions
12
app/server/migrations/2024040400_add_orgs_users_unique.up.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,12 @@ | ||
-- clean up any duplicates added mistakenly earlier | ||
WITH ranked_duplicates AS ( | ||
SELECT id, | ||
ROW_NUMBER() OVER (PARTITION BY org_id, user_id ORDER BY created_at) AS rn | ||
FROM orgs_users | ||
) | ||
DELETE FROM orgs_users | ||
WHERE id IN ( | ||
SELECT id FROM ranked_duplicates WHERE rn > 1 | ||
); | ||
|
||
ALTER TABLE orgs_users ADD CONSTRAINT org_user_unique UNIQUE (org_id, user_id); |
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 @@ | ||
- Fix for creating an org that auto-adds users based on email domain (https://github.com/plandex-ai/plandex/issues/24) |