mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
75fa580f3f
Summary: Ref T2222. This adds PHIDs to all Differential comments so I can migrate the inlinecommment table to transaction_comment in the next diff. @wez, this will issue a few million queries for Facebook (roughly, one for each Differential comment ever made). It's safe to skip the `.php` half of the patch, bring Phabricator up normally, and then apply this patch with Phabricator running if that eases the migration, although the next few diffs will probably be downtime-required migrations so maybe it's easier to just schedule some downtime. Test Plan: Ran migration locally. Verified existing comments and new comments received PHIDs. Reviewers: btrahan Reviewed By: btrahan CC: wez, aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D6266
23 lines
577 B
PHP
23 lines
577 B
PHP
<?php
|
|
|
|
$conn = id(new DifferentialRevision())->establishConnection('r');
|
|
|
|
echo "Assigning transaction PHIDs to DifferentialComments.\n";
|
|
foreach (new LiskRawMigrationIterator($conn, 'differential_comment') as $row) {
|
|
$id = $row['id'];
|
|
echo "Migrating comment #{$id}...\n";
|
|
if ($row['phid']) {
|
|
continue;
|
|
}
|
|
|
|
queryfx(
|
|
$conn,
|
|
'UPDATE %T SET phid = %s WHERE id = %d',
|
|
'differential_comment',
|
|
PhabricatorPHID::generateNewPHID(
|
|
PhabricatorPHIDConstants::PHID_TYPE_XACT,
|
|
PhabricatorPHIDConstants::PHID_TYPE_DREV),
|
|
$id);
|
|
}
|
|
|
|
echo "Done.\n";
|