From 3124838d65677b6ac424e8e8f507547edb0c659a Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 24 Jun 2013 11:00:35 -0700 Subject: [PATCH] Undo D6266 (DifferentialComment PHID migration) Summary: Ref T2222. My path forward here wasn't very good -- I was thinking I could set `transactionPHID` for the inline comments as I migrated, but it must be unique and an individual DifferentialComment may have more than one inline comment. Dropping the unique requirement just creates more issues for us, not fewer. So the migration in D6266 isn't actually useful. Undo it -- this can't be a straight revert because some installs may already have upgraded. Test Plan: Ran new migrations, verified the world ended up back in the same place as before (made comments, viewed reivsions). Reviewers: btrahan Reviewed By: btrahan CC: wez, aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D6269 --- .../patches/20130621.diffcommentphidmig.php | 22 +------------------ .../patches/20130621.diffcommentunphid.sql | 5 +++++ .../storage/DifferentialComment.php | 7 ------ .../DifferentialTransactionComment.php | 1 + .../patch/PhabricatorBuiltinPatchList.php | 4 ++++ 5 files changed, 11 insertions(+), 28 deletions(-) create mode 100644 resources/sql/patches/20130621.diffcommentunphid.sql diff --git a/resources/sql/patches/20130621.diffcommentphidmig.php b/resources/sql/patches/20130621.diffcommentphidmig.php index 92fcb6fd09..6a6baf280f 100644 --- a/resources/sql/patches/20130621.diffcommentphidmig.php +++ b/resources/sql/patches/20130621.diffcommentphidmig.php @@ -1,23 +1,3 @@ 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"; +// This patch is unnecessary and was nuked. diff --git a/resources/sql/patches/20130621.diffcommentunphid.sql b/resources/sql/patches/20130621.diffcommentunphid.sql new file mode 100644 index 0000000000..01d57146d6 --- /dev/null +++ b/resources/sql/patches/20130621.diffcommentunphid.sql @@ -0,0 +1,5 @@ +ALTER TABLE {$NAMESPACE}_differential.differential_comment + DROP phid; + +ALTER TABLE {$NAMESPACE}_differential.differential_transaction_comment + ADD legacyCommentID INT UNSIGNED; diff --git a/src/applications/differential/storage/DifferentialComment.php b/src/applications/differential/storage/DifferentialComment.php index 8182f6a883..401b291b51 100644 --- a/src/applications/differential/storage/DifferentialComment.php +++ b/src/applications/differential/storage/DifferentialComment.php @@ -20,12 +20,6 @@ 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; @@ -33,7 +27,6 @@ final class DifferentialComment extends DifferentialDAO public function getConfiguration() { return array( - self::CONFIG_AUX_PHID => true, self::CONFIG_SERIALIZATION => array( 'metadata' => self::SERIALIZATION_JSON, ), diff --git a/src/applications/differential/storage/DifferentialTransactionComment.php b/src/applications/differential/storage/DifferentialTransactionComment.php index 0f46665dac..c46d0c4b58 100644 --- a/src/applications/differential/storage/DifferentialTransactionComment.php +++ b/src/applications/differential/storage/DifferentialTransactionComment.php @@ -11,6 +11,7 @@ final class DifferentialTransactionComment protected $fixedState; protected $hasReplies = 0; protected $replyToCommentPHID; + protected $legacyCommentID; public function getApplicationTransactionObject() { return new DifferentialTransaction(); diff --git a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php index 32a49918d0..d324ca5226 100644 --- a/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php +++ b/src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php @@ -1390,6 +1390,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList { 'type' => 'php', 'name' => $this->getPatchPath('20130621.diffcommentphidmig.php'), ), + '20130621.diffcommentunphid.sql' => array( + 'type' => 'sql', + 'name' => $this->getPatchPath('20130621.diffcommentunphid.sql'), + ), ); } }