CREATE TABLE campuslive_users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  email VARCHAR(190) NOT NULL UNIQUE,
  username VARCHAR(50) NOT NULL UNIQUE,
  password_hash VARCHAR(255) NOT NULL,
  role ENUM('visiteur','etudiant','professeur','doyen') NOT NULL DEFAULT 'etudiant',
  verified TINYINT(1) NOT NULL DEFAULT 0,
  verify_token VARCHAR(120) DEFAULT NULL,
  verify_expires_at DATETIME DEFAULT NULL,
  mfa_secret VARCHAR(64) DEFAULT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  INDEX (verified),
  INDEX (role)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;