query("SELECT (case when max(id) then max(id) else 0 end)+1 from $table")->getValue() ?? 1); } }