chore: move default everyone group to a migration (#12435)

This commit is contained in:
Steven Masley
2024-03-12 09:27:36 -05:00
committed by GitHub
parent f3083226ab
commit e11d3ca0ee
4 changed files with 19 additions and 13 deletions

View File

@ -0,0 +1 @@
-- Nothing to do. If the group exists, this is ok.

View File

@ -0,0 +1,11 @@
-- This ensures a default everyone group exists for default org.
INSERT INTO
groups(name, id, organization_id)
SELECT
-- This is a special keyword that must be exactly this.
'Everyone',
-- Org ID and group ID must match.
(SELECT id FROM organizations WHERE is_default = true LIMIT 1),
(SELECT id FROM organizations WHERE is_default = true LIMIT 1)
-- It might already exist
ON CONFLICT DO NOTHING;