text: BEGIN;
  
  DROP TABLE IF EXISTS analysis_vulnerabilities CASCADE;
  
  ALTER TABLE vulnerabilities DROP COLUMN "type";
  
  ALTER TABLE vulnerabilities ADD analysis_id UUID NOT NULL;
  
  ALTER TABLE vulnerabilities ADD FOREIGN KEY (analysis_id) REFERENCES analysis (analysis_id) ON DELETE CASCADE;
  
  ALTER TABLE vulnerabilities ALTER COLUMN vuln_hash TYPE varchar(40) USING vuln_hash::varchar;
  
  COMMIT;