CREATE TABLE vulnerability_references (
    id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    vulnerability_id BIGINT NOT NULL REFERENCES vulnerabilities (id) ON DELETE CASCADE,
    source TEXT NOT NULL,
    url TEXT NOT NULL,
    title TEXT,
    tags JSONB NOT NULL DEFAULT '[]'::jsonb,
    created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
    UNIQUE (vulnerability_id, source, url)
);
