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

Add generic "attributes" storage to inline comment tables

Summary: Ref T13513. This plans for "currently editing", character range comments, code suggestions, document engine tracking. And absolutely nothing else.

Test Plan:
  - Ran `bin/storage upgrade -f`, got a clean upgrade.
  - Created and submitted some inline comments; nothing exploded.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21184
This commit is contained in:
epriestley 2020-04-28 13:38:46 -07:00
parent 54ec566281
commit 5ff0ae7d48
6 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_differential.differential_transaction_comment
ADD attributes LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_audit.audit_transaction_comment
ADD attributes LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_differential.differential_transaction_comment
SET attributes = '{}' WHERE attributes = '';

View file

@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_audit.audit_transaction_comment
SET attributes = '{}' WHERE attributes = '';

View file

@ -12,6 +12,7 @@ final class PhabricatorAuditTransactionComment
protected $hasReplies = 0; protected $hasReplies = 0;
protected $replyToCommentPHID; protected $replyToCommentPHID;
protected $legacyCommentID; protected $legacyCommentID;
protected $attributes = array();
private $replyToComment = self::ATTACHABLE; private $replyToComment = self::ATTACHABLE;
@ -54,6 +55,10 @@ final class PhabricatorAuditTransactionComment
), ),
) + $config[self::CONFIG_KEY_SCHEMA]; ) + $config[self::CONFIG_KEY_SCHEMA];
$config[self::CONFIG_SERIALIZATION] = array(
'attributes' => self::SERIALIZATION_JSON,
) + idx($config, self::CONFIG_SERIALIZATION, array());
return $config; return $config;
} }

View file

@ -11,6 +11,7 @@ final class DifferentialTransactionComment
protected $fixedState; protected $fixedState;
protected $hasReplies = 0; protected $hasReplies = 0;
protected $replyToCommentPHID; protected $replyToCommentPHID;
protected $attributes = array();
private $replyToComment = self::ATTACHABLE; private $replyToComment = self::ATTACHABLE;
private $isHidden = self::ATTACHABLE; private $isHidden = self::ATTACHABLE;
@ -32,6 +33,7 @@ final class DifferentialTransactionComment
protected function getConfiguration() { protected function getConfiguration() {
$config = parent::getConfiguration(); $config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array( $config[self::CONFIG_COLUMN_SCHEMA] = array(
'revisionPHID' => 'phid?', 'revisionPHID' => 'phid?',
'changesetID' => 'id?', 'changesetID' => 'id?',
@ -42,6 +44,7 @@ final class DifferentialTransactionComment
'hasReplies' => 'bool', 'hasReplies' => 'bool',
'replyToCommentPHID' => 'phid?', 'replyToCommentPHID' => 'phid?',
) + $config[self::CONFIG_COLUMN_SCHEMA]; ) + $config[self::CONFIG_COLUMN_SCHEMA];
$config[self::CONFIG_KEY_SCHEMA] = array( $config[self::CONFIG_KEY_SCHEMA] = array(
'key_draft' => array( 'key_draft' => array(
'columns' => array('authorPHID', 'transactionPHID'), 'columns' => array('authorPHID', 'transactionPHID'),
@ -53,6 +56,11 @@ final class DifferentialTransactionComment
'columns' => array('revisionPHID'), 'columns' => array('revisionPHID'),
), ),
) + $config[self::CONFIG_KEY_SCHEMA]; ) + $config[self::CONFIG_KEY_SCHEMA];
$config[self::CONFIG_SERIALIZATION] = array(
'attributes' => self::SERIALIZATION_JSON,
) + idx($config, self::CONFIG_SERIALIZATION, array());
return $config; return $config;
} }