this will fail with an exception if migration table does not exist. better call count($this->getMigrationHistory(null)) here.