Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20131004.dxreviewers.php
| <?php | <?php | ||||
| $table = new DifferentialRevision(); | $table = new DifferentialRevision(); | ||||
| $conn_w = $table->establishConnection('w'); | $conn_w = $table->establishConnection('w'); | ||||
| // NOTE: We migrate by revision because the relationship table doesn't have | // NOTE: We migrate by revision because the relationship table doesn't have | ||||
| // an "id" column. | // an "id" column. | ||||
| foreach (new LiskMigrationIterator($table) as $revision) { | foreach (new LiskMigrationIterator($table) as $revision) { | ||||
| $revision_id = $revision->getID(); | $revision_id = $revision->getID(); | ||||
| $revision_phid = $revision->getPHID(); | $revision_phid = $revision->getPHID(); | ||||
| echo "Migrating reviewers for D{$revision_id}...\n"; | echo pht('Migrating reviewers for %s...', "D{$revision_id}")."\n"; | ||||
| $reviewer_phids = queryfx_all( | $reviewer_phids = queryfx_all( | ||||
| $conn_w, | $conn_w, | ||||
| 'SELECT objectPHID FROM %T WHERE revisionID = %d | 'SELECT objectPHID FROM %T WHERE revisionID = %d | ||||
| AND relation = %s ORDER BY sequence', | AND relation = %s ORDER BY sequence', | ||||
| 'differential_relationship', | 'differential_relationship', | ||||
| $revision_id, | $revision_id, | ||||
| 'revw'); | 'revw'); | ||||
| Show All 21 Lines | $editor->addEdge( | ||||
| 'status' => DifferentialReviewerStatus::STATUS_ADDED, | 'status' => DifferentialReviewerStatus::STATUS_ADDED, | ||||
| ), | ), | ||||
| )); | )); | ||||
| } | } | ||||
| $editor->save(); | $editor->save(); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||