mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-19 03:01:11 +01:00
Generate expected schemata for Differential
Summary: Ref T1191. No major issues here. Test Plan: Saw ~150 fewer issues. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10577
This commit is contained in:
parent
9be2bf2119
commit
93681fcdbc
11 changed files with 245 additions and 5 deletions
|
@ -138,6 +138,10 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
||||||
'src' => array(
|
'src' => array(
|
||||||
'columns' => array('src', 'type', 'dateCreated', 'seq'),
|
'columns' => array('src', 'type', 'dateCreated', 'seq'),
|
||||||
),
|
),
|
||||||
|
'key_dst' => array(
|
||||||
|
'columns' => array('dst', 'type', 'src'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->buildRawSchema(
|
$this->buildRawSchema(
|
||||||
|
@ -251,16 +255,24 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
||||||
$charset = 'binary';
|
$charset = 'binary';
|
||||||
$collation = 'binary';
|
$collation = 'binary';
|
||||||
break;
|
break;
|
||||||
|
case 'bytes20':
|
||||||
|
$column_type = 'char(20)';
|
||||||
|
$charset = 'binary';
|
||||||
|
$collation = 'binary';
|
||||||
|
break;
|
||||||
case 'bytes12':
|
case 'bytes12':
|
||||||
$column_type = 'char(12)';
|
$column_type = 'char(12)';
|
||||||
$charset = 'binary';
|
$charset = 'binary';
|
||||||
$collation = 'binary';
|
$collation = 'binary';
|
||||||
break;
|
break;
|
||||||
case 'bytes':
|
case 'bytes4':
|
||||||
$column_type = 'longblob';
|
$column_type = 'char(4)';
|
||||||
$charset = 'binary';
|
$charset = 'binary';
|
||||||
$collation = 'binary';
|
$collation = 'binary';
|
||||||
break;
|
break;
|
||||||
|
case 'bytes':
|
||||||
|
$column_type = 'longblob';
|
||||||
|
break;
|
||||||
case 'text255':
|
case 'text255':
|
||||||
$column_type = 'varchar(255)';
|
$column_type = 'varchar(255)';
|
||||||
$charset = $this->getUTF8Charset();
|
$charset = $this->getUTF8Charset();
|
||||||
|
|
|
@ -14,6 +14,18 @@ final class DifferentialAffectedPath extends DifferentialDAO {
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'id' => null,
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'PRIMARY' => null,
|
||||||
|
'repositoryID' => array(
|
||||||
|
'columns' => array('repositoryID', 'pathID', 'epoch'),
|
||||||
|
),
|
||||||
|
'revisionID' => array(
|
||||||
|
'columns' => array('revisionID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,21 @@ final class DifferentialChangeset extends DifferentialDAO
|
||||||
'oldProperties' => self::SERIALIZATION_JSON,
|
'oldProperties' => self::SERIALIZATION_JSON,
|
||||||
'newProperties' => self::SERIALIZATION_JSON,
|
'newProperties' => self::SERIALIZATION_JSON,
|
||||||
'awayPaths' => self::SERIALIZATION_JSON,
|
'awayPaths' => self::SERIALIZATION_JSON,
|
||||||
)) + parent::getConfiguration();
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'oldFile' => 'text255?',
|
||||||
|
'filename' => 'text255',
|
||||||
|
'changeType' => 'uint32',
|
||||||
|
'fileType' => 'uint32',
|
||||||
|
'addLines' => 'uint32',
|
||||||
|
'delLines' => 'uint32',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'diffID' => array(
|
||||||
|
'columns' => array('diffID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAffectedLineCount() {
|
public function getAffectedLineCount() {
|
||||||
|
|
|
@ -42,6 +42,30 @@ final class DifferentialDiff
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'revisionID' => 'id?',
|
||||||
|
'authorPHID' => 'phid?',
|
||||||
|
'repositoryPHID' => 'phid?',
|
||||||
|
'sourceMachine' => 'text255?',
|
||||||
|
'sourcePath' => 'text255?',
|
||||||
|
'sourceControlSystem' => 'text64?',
|
||||||
|
'sourceControlBaseRevision' => 'text255?',
|
||||||
|
'sourceControlPath' => 'text255?',
|
||||||
|
'lintStatus' => 'uint32',
|
||||||
|
'unitStatus' => 'uint32',
|
||||||
|
'lineCount' => 'uint32',
|
||||||
|
'branch' => 'text255?',
|
||||||
|
'bookmark' => 'text255?',
|
||||||
|
'arcanistProjectPHID' => 'phid?',
|
||||||
|
'creationMethod' => 'text255',
|
||||||
|
'description' => 'text255',
|
||||||
|
'repositoryUUID' => 'text64?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'revisionID' => array(
|
||||||
|
'columns' => array('revisionID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,17 @@ final class DifferentialDiffProperty extends DifferentialDAO {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_SERIALIZATION => array(
|
self::CONFIG_SERIALIZATION => array(
|
||||||
'data' => self::SERIALIZATION_JSON,
|
'data' => self::SERIALIZATION_JSON,
|
||||||
)) + parent::getConfiguration();
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'name' => 'text255',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'diffID' => array(
|
||||||
|
'columns' => array('diffID', 'name'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,20 @@ final class DifferentialDraft extends DifferentialDAO {
|
||||||
protected $authorPHID;
|
protected $authorPHID;
|
||||||
protected $draftKey;
|
protected $draftKey;
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'draftKey' => 'text64',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_unique' => array(
|
||||||
|
'columns' => array('objectPHID', 'authorPHID', 'draftKey'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
public static function markHasDraft(
|
public static function markHasDraft(
|
||||||
$author_phid,
|
$author_phid,
|
||||||
$object_phid,
|
$object_phid,
|
||||||
|
|
|
@ -4,6 +4,23 @@ final class DifferentialHunkLegacy extends DifferentialHunk {
|
||||||
|
|
||||||
protected $changes;
|
protected $changes;
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
return array(
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'changes' => 'text?',
|
||||||
|
'oldOffset' => 'uint32',
|
||||||
|
'oldLen' => 'uint32',
|
||||||
|
'newOffset' => 'uint32',
|
||||||
|
'newLen' => 'uint32',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'changesetID' => array(
|
||||||
|
'columns' => array('changesetID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
) + parent::getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
public function getTableName() {
|
public function getTableName() {
|
||||||
return 'differential_hunk';
|
return 'differential_hunk';
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,23 @@ final class DifferentialHunkModern extends DifferentialHunk {
|
||||||
self::CONFIG_BINARY => array(
|
self::CONFIG_BINARY => array(
|
||||||
'data' => true,
|
'data' => true,
|
||||||
),
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'dataType' => 'bytes4',
|
||||||
|
'dataEncoding' => 'text16?',
|
||||||
|
'dataFormat' => 'bytes4',
|
||||||
|
'oldOffset' => 'uint32',
|
||||||
|
'oldLen' => 'uint32',
|
||||||
|
'newOffset' => 'uint32',
|
||||||
|
'newLen' => 'uint32',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_changeset' => array(
|
||||||
|
'columns' => array('changesetID'),
|
||||||
|
),
|
||||||
|
'key_created' => array(
|
||||||
|
'columns' => array('dateCreated'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,33 @@ final class DifferentialRevision extends DifferentialDAO
|
||||||
'attached' => self::SERIALIZATION_JSON,
|
'attached' => self::SERIALIZATION_JSON,
|
||||||
'unsubscribed' => self::SERIALIZATION_JSON,
|
'unsubscribed' => self::SERIALIZATION_JSON,
|
||||||
),
|
),
|
||||||
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'title' => 'text255',
|
||||||
|
'originalTitle' => 'text255',
|
||||||
|
'status' => 'text32',
|
||||||
|
'summary' => 'text',
|
||||||
|
'testPlan' => 'text',
|
||||||
|
'authorPHID' => 'phid?',
|
||||||
|
'lastReviewerPHID' => 'phid?',
|
||||||
|
'lineCount' => 'uint32?',
|
||||||
|
'mailKey' => 'bytes40',
|
||||||
|
'branchName' => 'text255',
|
||||||
|
'arcanistProjectPHID' => 'phid?',
|
||||||
|
'repositoryPHID' => 'phid?',
|
||||||
|
),
|
||||||
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
|
'key_phid' => null,
|
||||||
|
'phid' => array(
|
||||||
|
'columns' => array('phid'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'authorPHID' => array(
|
||||||
|
'columns' => array('authorPHID', 'status'),
|
||||||
|
),
|
||||||
|
'repositoryPHID' => array(
|
||||||
|
'columns' => array('repositoryPHID'),
|
||||||
|
),
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,74 @@ final class DifferentialSchemaSpec extends PhabricatorConfigSchemaSpec {
|
||||||
|
|
||||||
public function buildSchemata() {
|
public function buildSchemata() {
|
||||||
$this->buildLiskSchemata('DifferentialDAO');
|
$this->buildLiskSchemata('DifferentialDAO');
|
||||||
// $this->addEdgeSchemata($server, new DifferentialRevision());
|
|
||||||
|
$this->buildEdgeSchemata(new DifferentialRevision());
|
||||||
|
|
||||||
|
$this->buildTransactionSchema(
|
||||||
|
new DifferentialTransaction(),
|
||||||
|
new DifferentialTransactionComment());
|
||||||
|
|
||||||
|
$this->buildCustomFieldSchemata(
|
||||||
|
new DifferentialCustomFieldStorage(),
|
||||||
|
array(
|
||||||
|
new DifferentialCustomFieldNumericIndex(),
|
||||||
|
new DifferentialCustomFieldStringIndex(),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->buildRawSchema(
|
||||||
|
id(new DifferentialRevision())->getApplicationName(),
|
||||||
|
DifferentialChangeset::TABLE_CACHE,
|
||||||
|
array(
|
||||||
|
'id' => 'id',
|
||||||
|
'cache' => 'bytes',
|
||||||
|
'dateCreated' => 'epoch',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'PRIMARY' => array(
|
||||||
|
'columns' => array('id'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'dateCreated' => array(
|
||||||
|
'columns' => array('dateCreated'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->buildRawSchema(
|
||||||
|
id(new DifferentialRevision())->getApplicationName(),
|
||||||
|
DifferentialRevision::TABLE_COMMIT,
|
||||||
|
array(
|
||||||
|
'revisionID' => 'id',
|
||||||
|
'commitPHID' => 'phid',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'PRIMARY' => array(
|
||||||
|
'columns' => array('revisionID', 'commitPHID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
'commitPHID' => array(
|
||||||
|
'columns' => array('commitPHID'),
|
||||||
|
'unique' => true,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->buildRawSchema(
|
||||||
|
id(new DifferentialRevision())->getApplicationName(),
|
||||||
|
ArcanistDifferentialRevisionHash::TABLE_NAME,
|
||||||
|
array(
|
||||||
|
'revisionID' => 'id',
|
||||||
|
'type' => 'bytes4',
|
||||||
|
'hash' => 'bytes40',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'type' => array(
|
||||||
|
'columns' => array('type', 'hash'),
|
||||||
|
),
|
||||||
|
'revisionID' => array(
|
||||||
|
'columns' => array('revisionID'),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,32 @@ final class DifferentialTransactionComment
|
||||||
return new DifferentialTransaction();
|
return new DifferentialTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConfiguration() {
|
||||||
|
$config = parent::getConfiguration();
|
||||||
|
$config[self::CONFIG_COLUMN_SCHEMA] = array(
|
||||||
|
'revisionPHID' => 'phid?',
|
||||||
|
'changesetID' => 'id?',
|
||||||
|
'isNewFile' => 'bool',
|
||||||
|
'lineNumber' => 'uint32',
|
||||||
|
'lineLength' => 'uint32',
|
||||||
|
'fixedState' => 'text12?',
|
||||||
|
'hasReplies' => 'bool',
|
||||||
|
'replyToCommentPHID' => 'phid?',
|
||||||
|
) + $config[self::CONFIG_COLUMN_SCHEMA];
|
||||||
|
$config[self::CONFIG_KEY_SCHEMA] = array(
|
||||||
|
'key_draft' => array(
|
||||||
|
'columns' => array('authorPHID', 'transactionPHID'),
|
||||||
|
),
|
||||||
|
'key_changeset' => array(
|
||||||
|
'columns' => array('changesetID'),
|
||||||
|
),
|
||||||
|
'key_revision' => array(
|
||||||
|
'columns' => array('revisionPHID'),
|
||||||
|
),
|
||||||
|
) + $config[self::CONFIG_KEY_SCHEMA];
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
public function shouldUseMarkupCache($field) {
|
public function shouldUseMarkupCache($field) {
|
||||||
// Only cache submitted comments.
|
// Only cache submitted comments.
|
||||||
return ($this->getTransactionPHID() != null);
|
return ($this->getTransactionPHID() != null);
|
||||||
|
|
Loading…
Reference in a new issue