-- +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;