Files
Containr/app/backend/migrations_goose/20260920000000_notifications.sql
Tomas Dvorak 07ac54aa05 feat(notifications): persistent notification center
- notifications table (goose migration) + sqlc queries; list with unread
  count, mark-one, mark-all endpoints under /notifications.
- Deployment success/failure now writes a notification row for the owner
  (insertUserNotification — best-effort, never breaks the deploy flow).
- Shell bell reads the real persisted feed: unread badge, click-to-read,
  mark-all, 30s polling. Replaces the transient builds+audit derivation.

Verified e2e: migration applies clean, list/read/read-all round-trips.

Authored By: TDvorak <[email protected]>
2026-09-17 17:52:37 +02:00

20 lines
740 B
SQL

-- +goose Up
CREATE TABLE IF NOT EXISTS public.notifications (
id uuid DEFAULT gen_random_uuid() NOT NULL,
user_id uuid NOT NULL,
kind character varying(50) NOT NULL,
title character varying(255) NOT NULL,
body text,
resource_type character varying(50),
resource_id character varying(255),
read_at timestamp with time zone,
created_at timestamp with time zone DEFAULT now(),
CONSTRAINT notifications_pkey PRIMARY KEY (id),
CONSTRAINT fk_notifications_user FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_notifications_user_created ON public.notifications(user_id, created_at DESC);
-- +goose Down
DROP TABLE IF EXISTS public.notifications;