-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6773 from TheThingsNetwork/issue/6751-notificatio…
…n-fanout-opt Organization `fanout_notifications` option
- Loading branch information
Showing
24 changed files
with
497 additions
and
204 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
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
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
16 changes: 16 additions & 0 deletions
16
pkg/identityserver/store/migrations/20231211000000_organization_notification_fanout.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,16 @@ | ||
ALTER TABLE organizations | ||
DROP COLUMN IF EXISTS fanout_notifications CASCADE; | ||
|
||
--bun:split | ||
CREATE OR REPLACE VIEW organization_accounts AS | ||
SELECT | ||
acc.id AS account_id, | ||
acc.created_at AS account_created_at, | ||
acc.updated_at AS account_updated_at, | ||
acc.deleted_at AS account_deleted_at, | ||
acc.uid AS account_uid, | ||
org.* | ||
FROM | ||
accounts acc | ||
JOIN organizations org ON org.id = acc.account_id | ||
AND acc.account_type = 'organization'; |
22 changes: 22 additions & 0 deletions
22
pkg/identityserver/store/migrations/20231211000000_organization_notification_fanout.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,22 @@ | ||
ALTER TABLE | ||
organizations | ||
ADD | ||
COLUMN IF NOT EXISTS fanout_notifications BOOLEAN; | ||
|
||
--bun:split | ||
UPDATE organizations SET fanout_notifications = TRUE; | ||
|
||
--bun:split | ||
CREATE | ||
OR REPLACE VIEW organization_accounts AS | ||
SELECT | ||
acc.id AS account_id, | ||
acc.created_at AS account_created_at, | ||
acc.updated_at AS account_updated_at, | ||
acc.deleted_at AS account_deleted_at, | ||
acc.uid AS account_uid, | ||
org.* | ||
FROM | ||
accounts acc | ||
JOIN organizations org ON org.id = acc.account_id | ||
AND acc.account_type = 'organization'; |
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
Oops, something went wrong.