suppress_errors(true); try{foreach(Schema::usageCountingMode($wpdb)as $table=>$sql){ $columns=$wpdb->get_col($wpdb->prepare('SHOW COLUMNS FROM %i',$table));$this->check($wpdb); if(!in_array('counting_mode',$columns,true)){$wpdb->query($wpdb->prepare("ALTER TABLE %i ADD counting_mode varchar(30) NOT NULL DEFAULT 'full_duration' AFTER limit_minutes",$table));$this->check($wpdb);} Schema::verify($wpdb,$table,$sql); }}finally{$wpdb->suppress_errors($old);} } private function check(\wpdb $wpdb):void{if($wpdb->last_error)throw new RuntimeException(__('ABeCe Booking database migration failed. Existing data has been retained.','abece-booking'));} }