mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
Merge branch 'main' of github.com:/coder/coder into dk/prebuilds
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
This commit is contained in:
@ -0,0 +1,3 @@
|
||||
DROP TABLE IF EXISTS inbox_notifications;
|
||||
|
||||
DROP TYPE IF EXISTS inbox_notification_read_status;
|
17
coderd/database/migrations/000297_notifications_inbox.up.sql
Normal file
17
coderd/database/migrations/000297_notifications_inbox.up.sql
Normal file
@ -0,0 +1,17 @@
|
||||
CREATE TYPE inbox_notification_read_status AS ENUM ('all', 'unread', 'read');
|
||||
|
||||
CREATE TABLE inbox_notifications (
|
||||
id UUID PRIMARY KEY,
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
template_id UUID NOT NULL REFERENCES notification_templates(id) ON DELETE CASCADE,
|
||||
targets UUID[],
|
||||
title TEXT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
icon TEXT NOT NULL,
|
||||
actions JSONB NOT NULL,
|
||||
read_at TIMESTAMP WITH TIME ZONE,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_inbox_notifications_user_id_read_at ON inbox_notifications(user_id, read_at);
|
||||
CREATE INDEX idx_inbox_notifications_user_id_template_id_targets ON inbox_notifications(user_id, template_id, targets);
|
@ -0,0 +1 @@
|
||||
DROP INDEX idx_provisioner_jobs_status;
|
@ -0,0 +1 @@
|
||||
CREATE INDEX idx_provisioner_jobs_status ON provisioner_jobs USING btree (job_status);
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
@ -17,7 +18,6 @@ import (
|
||||
"github.com/lib/pq"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/goleak"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database/dbtestutil"
|
||||
|
25
coderd/database/migrations/testdata/fixtures/000297_notifications_inbox.up.sql
vendored
Normal file
25
coderd/database/migrations/testdata/fixtures/000297_notifications_inbox.up.sql
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
INSERT INTO
|
||||
inbox_notifications (
|
||||
id,
|
||||
user_id,
|
||||
template_id,
|
||||
targets,
|
||||
title,
|
||||
content,
|
||||
icon,
|
||||
actions,
|
||||
read_at,
|
||||
created_at
|
||||
)
|
||||
VALUES (
|
||||
'68b396aa-7f53-4bf1-b8d8-4cbf5fa244e5', -- uuid
|
||||
'5755e622-fadd-44ca-98da-5df070491844', -- uuid
|
||||
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', -- uuid
|
||||
ARRAY[]::UUID[], -- uuid[]
|
||||
'Test Notification',
|
||||
'This is a test notification',
|
||||
'https://test.coder.com/favicon.ico',
|
||||
'{}',
|
||||
'2025-01-01 00:00:00',
|
||||
'2025-01-01 00:00:00'
|
||||
);
|
Reference in New Issue
Block a user