-
Notifications
You must be signed in to change notification settings - Fork 888
chore: move default everyone group to a migration #12435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- Nothing to do. If the group exists, this is ok. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not required, the unique index should protect this. I added the |
||
-- It might already exist | ||
ON CONFLICT DO NOTHING; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbmem doesn't have the concept of "migrations". I wonder if we should have something similar rather than chucking them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think "migrations" is the right concept, since we don't ever change an old dbmem into a new one, but it might make sense to have an abstraction that populates the initial contents of the database, which is what this does...