1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Add storage for new Differential transactions and transaction comments

Summary:
Ref T2222. Ref T1460. Depends on D6260.

This creates the new tables, but doesn't start using them. I added three new fields for {T1460}, to represent fixed/done/replied states.

Test Plan: Ran storage upgrade.

Reviewers: btrahan

Reviewed By: btrahan

CC: chad, aran

Maniphest Tasks: T1460, T2222

Differential Revision: https://secure.phabricator.com/D6261
This commit is contained in:
epriestley 2013-06-21 12:54:29 -07:00
parent 6a2e27ba8d
commit 44302d2f07
5 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,51 @@
CREATE TABLE {$NAMESPACE}_differential.differential_transaction (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
objectPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
commentPHID VARCHAR(64) COLLATE utf8_bin,
commentVersion INT UNSIGNED NOT NULL,
transactionType VARCHAR(32) NOT NULL COLLATE utf8_bin,
oldValue LONGTEXT NOT NULL COLLATE utf8_bin,
newValue LONGTEXT NOT NULL COLLATE utf8_bin,
contentSource LONGTEXT NOT NULL COLLATE utf8_bin,
metadata LONGTEXT NOT NULL COLLATE utf8_bin,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (phid),
KEY `key_object` (objectPHID)
) ENGINE=InnoDB, COLLATE utf8_general_ci;
CREATE TABLE {$NAMESPACE}_differential.differential_transaction_comment (
id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
phid VARCHAR(64) NOT NULL COLLATE utf8_bin,
transactionPHID VARCHAR(64) COLLATE utf8_bin,
authorPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
viewPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
editPolicy VARCHAR(64) NOT NULL COLLATE utf8_bin,
commentVersion INT UNSIGNED NOT NULL,
content LONGTEXT NOT NULL COLLATE utf8_bin,
contentSource LONGTEXT NOT NULL COLLATE utf8_bin,
isDeleted BOOL NOT NULL,
dateCreated INT UNSIGNED NOT NULL,
dateModified INT UNSIGNED NOT NULL,
revisionPHID VARCHAR(64) NOT NULL COLLATE utf8_bin,
changesetID INT UNSIGNED,
isNewFile BOOL NOT NULL,
lineNumber INT UNSIGNED NOT NULL,
lineLength INT UNSIGNED NOT NULL,
fixedState VARCHAR(12) COLLATE utf8_bin,
hasReplies BOOL NOT NULL,
replyToCommentPHID VARCHAR(64),
UNIQUE KEY `key_phid` (phid),
UNIQUE KEY `key_version` (transactionPHID, commentVersion),
UNIQUE KEY `key_draft` (authorPHID, revisionPHID, transactionPHID)
) ENGINE=InnoDB, COLLATE utf8_general_ci;

View file

@ -417,6 +417,8 @@ phutil_register_library_map(array(
'DifferentialTasksAttacher' => 'applications/differential/DifferentialTasksAttacher.php',
'DifferentialTestPlanFieldSpecification' => 'applications/differential/field/specification/DifferentialTestPlanFieldSpecification.php',
'DifferentialTitleFieldSpecification' => 'applications/differential/field/specification/DifferentialTitleFieldSpecification.php',
'DifferentialTransaction' => 'applications/differential/storage/DifferentialTransaction.php',
'DifferentialTransactionComment' => 'applications/differential/storage/DifferentialTransactionComment.php',
'DifferentialUnitFieldSpecification' => 'applications/differential/field/specification/DifferentialUnitFieldSpecification.php',
'DifferentialUnitStatus' => 'applications/differential/constants/DifferentialUnitStatus.php',
'DifferentialUnitTestResult' => 'applications/differential/constants/DifferentialUnitTestResult.php',
@ -2292,6 +2294,8 @@ phutil_register_library_map(array(
'DifferentialSummaryFieldSpecification' => 'DifferentialFreeformFieldSpecification',
'DifferentialTestPlanFieldSpecification' => 'DifferentialFieldSpecification',
'DifferentialTitleFieldSpecification' => 'DifferentialFreeformFieldSpecification',
'DifferentialTransaction' => 'PhabricatorApplicationTransaction',
'DifferentialTransactionComment' => 'PhabricatorApplicationTransactionComment',
'DifferentialUnitFieldSpecification' => 'DifferentialFieldSpecification',
'DiffusionBranchTableController' => 'DiffusionController',
'DiffusionBranchTableView' => 'DiffusionView',

View file

@ -0,0 +1,21 @@
<?php
final class DifferentialTransaction extends PhabricatorApplicationTransaction {
public function getApplicationName() {
return 'differential';
}
public function getApplicationTransactionType() {
return PhabricatorPHIDConstants::PHID_TYPE_DREV;
}
public function getApplicationTransactionCommentObject() {
return new DifferentialTransactionComment();
}
public function getApplicationObjectTypeName() {
return pht('revision');
}
}

View file

@ -0,0 +1,23 @@
<?php
final class DifferentialTransactionComment
extends PhabricatorApplicationTransactionComment {
protected $revisionPHID;
protected $changesetID;
protected $isNewFile;
protected $lineNumber;
protected $lineLength;
protected $fixedState;
protected $hasReplies = 0;
protected $replyToCommentPHID;
public function getApplicationTransactionObject() {
return new DifferentialTransaction();
}
public function shouldUseMarkupCache($field) {
// Only cache submitted comments.
return ($this->getTransactionPHID() != null);
}
}

View file

@ -1378,6 +1378,10 @@ final class PhabricatorBuiltinPatchList extends PhabricatorSQLPatchList {
'type' => 'php',
'name' => $this->getPatchPath('20130619.authconf.php'),
),
'20130620.diffxactions.sql' => array(
'type' => 'sql',
'name' => $this->getPatchPath('20130620.diffxactions.sql'),
),
);
}
}