ALTER TABLE users MODIFY role ENUM('client','admin','employee') NOT NULL DEFAULT 'client';

ALTER TABLE interventions
  ADD COLUMN assigned_user_id INT UNSIGNED NULL AFTER user_id,
  ADD COLUMN hourly_rate DECIMAL(10,2) NOT NULL DEFAULT 0 AFTER ends_at,
  ADD COLUMN actual_duration_minutes INT UNSIGNED NOT NULL DEFAULT 0 AFTER hourly_rate,
  ADD COLUMN completed_at DATETIME NULL AFTER actual_duration_minutes,
  ADD COLUMN work_note TEXT NULL AFTER client_comment,
  ADD COLUMN recurring_group VARCHAR(40) NULL AFTER work_note,
  ADD INDEX idx_interventions_assigned (assigned_user_id),
  ADD CONSTRAINT fk_interventions_assigned_user FOREIGN KEY (assigned_user_id) REFERENCES users(id) ON DELETE SET NULL;
