-- Add rule-builder fields to vendor_doc_profiles
ALTER TABLE vendor_doc_profiles
  ADD COLUMN uom_regex TEXT NULL,
  ADD COLUMN item_row_regex TEXT NULL,
  ADD COLUMN number_regex TEXT NULL,
  ADD COLUMN postprocess_json TEXT NULL;

-- Add audit fields to doc_parse_log
ALTER TABLE doc_parse_log
  ADD COLUMN user_id INT NULL,
  ADD COLUMN vendor_id INT NULL;

-- Ensure UTF8MB4 for vendor_doc_profiles to store diacritics
ALTER TABLE vendor_doc_profiles
  CONVERT TO CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;
