1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

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
This commit is contained in:
epriestley 2013-06-21 18:41:14 -07:00
parent 64bfd7630e
commit 75fa580f3f
5 changed files with 88 additions and 45 deletions

View file

@ -0,0 +1,5 @@
ALTER TABLE {$NAMESPACE}_differential.differential_comment
ADD phid VARCHAR(64) NOT NULL COLLATE utf8_bin;
ALTER TABLE {$NAMESPACE}_differential.differential_comment
ADD KEY `key_phid` (phid);

View file

@ -0,0 +1,23 @@
<?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";

View file

@ -3723,7 +3723,7 @@ celerity_register_resource_map(array(
),
'phui-form-css' =>
array(
'uri' => '/res/eb478e83/rsrc/css/phui/phui-form.css',
'uri' => '/res/c02b6db7/rsrc/css/phui/phui-form.css',
'type' => 'css',
'requires' =>
array(
@ -4057,7 +4057,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
'695153c6' =>
'e8febb7b' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -4105,7 +4105,7 @@ celerity_register_resource_map(array(
40 => 'phabricator-property-list-view-css',
41 => 'phabricator-tag-view-css',
),
'uri' => '/res/pkg/695153c6/core.pkg.css',
'uri' => '/res/pkg/e8febb7b/core.pkg.css',
'type' => 'css',
),
'f2ad0683' =>
@ -4299,16 +4299,16 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => 'adc3c36d',
'aphront-dialog-view-css' => '695153c6',
'aphront-error-view-css' => '695153c6',
'aphront-form-view-css' => '695153c6',
'aphront-list-filter-view-css' => '695153c6',
'aphront-pager-view-css' => '695153c6',
'aphront-panel-view-css' => '695153c6',
'aphront-table-view-css' => '695153c6',
'aphront-tokenizer-control-css' => '695153c6',
'aphront-tooltip-css' => '695153c6',
'aphront-typeahead-control-css' => '695153c6',
'aphront-dialog-view-css' => 'e8febb7b',
'aphront-error-view-css' => 'e8febb7b',
'aphront-form-view-css' => 'e8febb7b',
'aphront-list-filter-view-css' => 'e8febb7b',
'aphront-pager-view-css' => 'e8febb7b',
'aphront-panel-view-css' => 'e8febb7b',
'aphront-table-view-css' => 'e8febb7b',
'aphront-tokenizer-control-css' => 'e8febb7b',
'aphront-tooltip-css' => 'e8febb7b',
'aphront-typeahead-control-css' => 'e8febb7b',
'differential-changeset-view-css' => 'dd27a69b',
'differential-core-view-css' => 'dd27a69b',
'differential-inline-comment-editor' => '9488bb69',
@ -4322,7 +4322,7 @@ celerity_register_resource_map(array(
'differential-table-of-contents-css' => 'dd27a69b',
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '695153c6',
'global-drag-and-drop-css' => 'e8febb7b',
'inline-comment-summary-css' => 'dd27a69b',
'javelin-aphlict' => 'f2ad0683',
'javelin-behavior' => 'a9f14d76',
@ -4396,55 +4396,55 @@ celerity_register_resource_map(array(
'javelin-util' => 'a9f14d76',
'javelin-vector' => 'a9f14d76',
'javelin-workflow' => 'a9f14d76',
'lightbox-attachment-css' => '695153c6',
'lightbox-attachment-css' => 'e8febb7b',
'maniphest-task-summary-css' => 'adc3c36d',
'maniphest-transaction-detail-css' => 'adc3c36d',
'phabricator-action-list-view-css' => '695153c6',
'phabricator-application-launch-view-css' => '695153c6',
'phabricator-action-list-view-css' => 'e8febb7b',
'phabricator-application-launch-view-css' => 'e8febb7b',
'phabricator-busy' => 'f2ad0683',
'phabricator-content-source-view-css' => 'dd27a69b',
'phabricator-core-css' => '695153c6',
'phabricator-crumbs-view-css' => '695153c6',
'phabricator-core-css' => 'e8febb7b',
'phabricator-crumbs-view-css' => 'e8febb7b',
'phabricator-drag-and-drop-file-upload' => '9488bb69',
'phabricator-dropdown-menu' => 'f2ad0683',
'phabricator-file-upload' => 'f2ad0683',
'phabricator-filetree-view-css' => '695153c6',
'phabricator-flag-css' => '695153c6',
'phabricator-form-view-css' => '695153c6',
'phabricator-header-view-css' => '695153c6',
'phabricator-filetree-view-css' => 'e8febb7b',
'phabricator-flag-css' => 'e8febb7b',
'phabricator-form-view-css' => 'e8febb7b',
'phabricator-header-view-css' => 'e8febb7b',
'phabricator-hovercard' => 'f2ad0683',
'phabricator-jump-nav' => '695153c6',
'phabricator-jump-nav' => 'e8febb7b',
'phabricator-keyboard-shortcut' => 'f2ad0683',
'phabricator-keyboard-shortcut-manager' => 'f2ad0683',
'phabricator-main-menu-view' => '695153c6',
'phabricator-main-menu-view' => 'e8febb7b',
'phabricator-menu-item' => 'f2ad0683',
'phabricator-nav-view-css' => '695153c6',
'phabricator-nav-view-css' => 'e8febb7b',
'phabricator-notification' => 'f2ad0683',
'phabricator-notification-css' => '695153c6',
'phabricator-notification-menu-css' => '695153c6',
'phabricator-object-item-list-view-css' => '695153c6',
'phabricator-notification-css' => 'e8febb7b',
'phabricator-notification-menu-css' => 'e8febb7b',
'phabricator-object-item-list-view-css' => 'e8febb7b',
'phabricator-object-selector-css' => 'dd27a69b',
'phabricator-phtize' => 'f2ad0683',
'phabricator-prefab' => 'f2ad0683',
'phabricator-project-tag-css' => 'adc3c36d',
'phabricator-property-list-view-css' => '695153c6',
'phabricator-remarkup-css' => '695153c6',
'phabricator-property-list-view-css' => 'e8febb7b',
'phabricator-remarkup-css' => 'e8febb7b',
'phabricator-shaped-request' => '9488bb69',
'phabricator-side-menu-view-css' => '695153c6',
'phabricator-standard-page-view' => '695153c6',
'phabricator-tag-view-css' => '695153c6',
'phabricator-side-menu-view-css' => 'e8febb7b',
'phabricator-standard-page-view' => 'e8febb7b',
'phabricator-tag-view-css' => 'e8febb7b',
'phabricator-textareautils' => 'f2ad0683',
'phabricator-tooltip' => 'f2ad0683',
'phabricator-transaction-view-css' => '695153c6',
'phabricator-zindex-css' => '695153c6',
'phui-button-css' => '695153c6',
'phui-form-css' => '695153c6',
'phui-icon-view-css' => '695153c6',
'phui-spacing-css' => '695153c6',
'sprite-apps-large-css' => '695153c6',
'sprite-gradient-css' => '695153c6',
'sprite-icons-css' => '695153c6',
'sprite-menu-css' => '695153c6',
'syntax-highlighting-css' => '695153c6',
'phabricator-transaction-view-css' => 'e8febb7b',
'phabricator-zindex-css' => 'e8febb7b',
'phui-button-css' => 'e8febb7b',
'phui-form-css' => 'e8febb7b',
'phui-icon-view-css' => 'e8febb7b',
'phui-spacing-css' => 'e8febb7b',
'sprite-apps-large-css' => 'e8febb7b',
'sprite-gradient-css' => 'e8febb7b',
'sprite-icons-css' => 'e8febb7b',
'sprite-menu-css' => 'e8febb7b',
'syntax-highlighting-css' => 'e8febb7b',
),
));

View file

@ -20,6 +20,12 @@ final class DifferentialComment extends DifferentialDAO
private $arbitraryDiffForFacebook;
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_XACT,
PhabricatorPHIDConstants::PHID_TYPE_DREV);
}
public function giveFacebookSomeArbitraryDiff(DifferentialDiff $diff) {
$this->arbitraryDiffForFacebook = $diff;
return $this;
@ -27,6 +33,7 @@ final class DifferentialComment extends DifferentialDAO
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array(
'metadata' => self::SERIALIZATION_JSON,
),

View file

@ -1382,6 +1382,14 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'sql',
'name' => $this->getPatchPath('20130620.diffxactions.sql'),
),
'20130621.diffcommentphid.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130621.diffcommentphid.sql'),
),
'20130621.diffcommentphidmig.php' => array(
'type' => 'php',
'name' => $this->getPatchPath('20130621.diffcommentphidmig.php'),
),
);
}
}