Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130926.dinline.php
| <?php | <?php | ||||
| $revision_table = new DifferentialRevision(); | $revision_table = new DifferentialRevision(); | ||||
| $conn_w = $revision_table->establishConnection('w'); | $conn_w = $revision_table->establishConnection('w'); | ||||
| $conn_w->openTransaction(); | $conn_w->openTransaction(); | ||||
| $src_table = 'differential_inlinecomment'; | $src_table = 'differential_inlinecomment'; | ||||
| $dst_table = 'differential_transaction_comment'; | $dst_table = 'differential_transaction_comment'; | ||||
| echo "Migrating Differential inline comments to new format...\n"; | echo pht('Migrating Differential inline comments to new format...')."\n"; | ||||
| $content_source = PhabricatorContentSource::newForSource( | $content_source = PhabricatorContentSource::newForSource( | ||||
| PhabricatorContentSource::SOURCE_LEGACY, | PhabricatorContentSource::SOURCE_LEGACY, | ||||
| array())->serialize(); | array())->serialize(); | ||||
| $rows = new LiskRawMigrationIterator($conn_w, $src_table); | $rows = new LiskRawMigrationIterator($conn_w, $src_table); | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $id = $row['id']; | $id = $row['id']; | ||||
| $revision_id = $row['revisionID']; | $revision_id = $row['revisionID']; | ||||
| echo "Migrating inline #{$id} (D{$revision_id})...\n"; | echo pht('Migrating inline #%d (%s)...', $id, "D{$revision_id}")."\n"; | ||||
| $revision_row = queryfx_one( | $revision_row = queryfx_one( | ||||
| $conn_w, | $conn_w, | ||||
| 'SELECT phid FROM %T WHERE id = %d', | 'SELECT phid FROM %T WHERE id = %d', | ||||
| $revision_table->getTableName(), | $revision_table->getTableName(), | ||||
| $revision_id); | $revision_id); | ||||
| if (!$revision_row) { | if (!$revision_row) { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | queryfx( | ||||
| $row['lineNumber'], | $row['lineNumber'], | ||||
| $row['lineLength'], | $row['lineLength'], | ||||
| 0, | 0, | ||||
| $row['commentID']); | $row['commentID']); | ||||
| } | } | ||||
| $conn_w->saveTransaction(); | $conn_w->saveTransaction(); | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||