-
Notifications
You must be signed in to change notification settings - Fork 887
feat: create database tables and queries for notifications #13536
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @dannykopping and the rest of your teammates on |
1cb776a
to
25636ec
Compare
coderd/database/migrations/testdata/fixtures/000219_notifications.up.sql
Outdated
Show resolved
Hide resolved
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.
Some comments below, but nothing blocking.
1c4046c
to
538bc42
Compare
coderd/database/migrations/testdata/fixtures/000219_notifications.up.sql
Outdated
Show resolved
Hide resolved
538bc42
to
438bcba
Compare
Signed-off-by: Danny Kopping <danny@coder.com>
Signed-off-by: Danny Kopping <danny@coder.com>
This has the unfortunate side-effect of not allowing the AcquireNotificationMessagesRow.Payload type to be overriden to []byte as it was previously, but it does not change the semantics Signed-off-by: Danny Kopping <danny@coder.com>
438bcba
to
c1a3010
Compare
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.
@spikecurtis I'm back from PTO. I believe I've addressed all of your comments.
Can you please have another look?
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.
LGTM
One comment inline, but I don't need to review again.
WHEN (attempt_count + 1 < @max_attempts::int) | ||
THEN NOW() + CONCAT(@retry_interval::int, ' seconds')::interval END | ||
FROM (SELECT id, status, status_reason, failed_at | ||
FROM new_values) AS subquery |
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.
This query is also doing the WITH new_values
thing where we then essentially rename new_values
to subquery
. Can be simplified to remove the WITH
clause and unnest the values here in the FROM
clause.
Signed-off-by: Danny Kopping <danny@coder.com>
Creates two new tables:
notification_templates
: templates are used to create notifications from, and specify a unique event in the systemnotification_messages
: each record corresponds to a separate notification which must be delivered to a userAcquireNotificationMessages
)coderd/database/migrations/000219_notifications.up.sql
inserts a single template ("Workspace Deleted"), for which we are creating this vertical slice in this initial stack of PRs.