-- Add receipt_document_id FK to link maintenance records to scanned receipt documents
ALTER TABLE maintenance_records
  ADD COLUMN receipt_document_id UUID REFERENCES documents(id) ON DELETE SET NULL;

-- Index for querying records by receipt document
CREATE INDEX idx_maintenance_records_receipt_document_id ON maintenance_records(receipt_document_id)
  WHERE receipt_document_id IS NOT NULL;
