Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140420.rel.2.objectmig.php
| <?php | <?php | ||||
| $pull_table = new ReleephRequest(); | $pull_table = new ReleephRequest(); | ||||
| $table_name = $pull_table->getTableName(); | $table_name = $pull_table->getTableName(); | ||||
| $conn_w = $pull_table->establishConnection('w'); | $conn_w = $pull_table->establishConnection('w'); | ||||
| echo "Setting object PHIDs for requests...\n"; | echo pht('Setting object PHIDs for requests...')."\n"; | ||||
| foreach (new LiskMigrationIterator($pull_table) as $pull) { | foreach (new LiskMigrationIterator($pull_table) as $pull) { | ||||
| $id = $pull->getID(); | $id = $pull->getID(); | ||||
| echo "Migrating pull request {$id}...\n"; | echo pht('Migrating pull request %d...', $id)."\n"; | ||||
| if ($pull->getRequestedObjectPHID()) { | if ($pull->getRequestedObjectPHID()) { | ||||
| // We already have a valid PHID, so skip this request. | // We already have a valid PHID, so skip this request. | ||||
| continue; | continue; | ||||
| } | } | ||||
| $commit_phids = $pull->getCommitPHIDs(); | $commit_phids = $pull->getCommitPHIDs(); | ||||
| if (count($commit_phids) != 1) { | if (count($commit_phids) != 1) { | ||||
| // At the time this migration was written, all requests had exactly one | // At the time this migration was written, all requests had exactly one | ||||
| Show All 17 Lines | foreach (new LiskMigrationIterator($pull_table) as $pull) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET requestedObjectPHID = %s WHERE id = %d', | 'UPDATE %T SET requestedObjectPHID = %s WHERE id = %d', | ||||
| $table_name, | $table_name, | ||||
| $object_phid, | $object_phid, | ||||
| $id); | $id); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||