[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 131.migraterevisionquery.php (source)

   1  <?php
   2  
   3  $table = new DifferentialRevision();
   4  $table->openTransaction();
   5  $table->beginReadLocking();
   6  $conn_w = $table->establishConnection('w');
   7  
   8  echo 'Migrating revisions';
   9  do {
  10    $revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000');
  11  
  12    foreach ($revisions as $revision) {
  13      echo '.';
  14  
  15      $diff = $revision->loadActiveDiff();
  16      if (!$diff) {
  17        continue;
  18      }
  19  
  20      $branch_name = $diff->getBranch();
  21      $arc_project_phid = $diff->getArcanistProjectPHID();
  22  
  23      queryfx(
  24        $conn_w,
  25        'UPDATE %T SET branchName = %s, arcanistProjectPHID = %s WHERE id = %d',
  26        $table->getTableName(),
  27        $branch_name,
  28        $arc_project_phid,
  29        $revision->getID());
  30    }
  31  } while (count($revisions) == 1000);
  32  
  33  $table->endReadLocking();
  34  $table->saveTransaction();
  35  echo "\nDone.\n";


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1