1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00
phorge-phorge/resources/sql/patches/20130621.diffcommentphidmig.php
epriestley 75fa580f3f Add PHIDs to DifferentialComments
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
2013-06-21 18:41:14 -07:00

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";