CREATE TABLE IF NOT EXISTS document_versions (
  id VARCHAR(36) PRIMARY KEY,
  document_id VARCHAR(255) NOT NULL,
  version_number INT NOT NULL,
  file_url TEXT NOT NULL,
  uploaded_by VARCHAR(255),
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  change_notes TEXT
);

ALTER TABLE documents ADD COLUMN version_number INT DEFAULT 1;
