If you have registered several dynamic migrations which all have the same query (only differing in a parameter to the query), if you set cache_counts to TRUE all the migrations will show the same count, of the first one to be counted. This is because the cache key is derived from (string)$this ($this being the source class), which is the query string (via __toString()). The migration arguments should be taken into account. It may actually be nice to work the arguments into __toString(), so they can be viewed in the UI.

Comments

mikeryan’s picture

Status: Active » Fixed

Well, so much for that idea - the source class has no idea what the migration is, and thus what the parameters are. Solved this by added a 'cache_key' option to the source class constructor, so the caller can explicitly set it to something unique:

    $this->source = new MigrateSourceSQL($query, $fields, NULL,
      array('map_joinable' => FALSE, 'cache_counts' => TRUE,
           'cache_key' => 'migrate_' . $this->machineName));

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.