1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Generate expected schemata for Fact, Owners, Herald and Diviner

Summary:
Ref T1191. Notable:

  - `HeraldApplyTranscript` is not actually a DAO and has no table (it is serialized into HeraldTranscript).

Test Plan: Down to fewer than 300 issues.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10588
This commit is contained in:
epriestley 2014-10-01 07:53:12 -07:00
parent cfbcd69e9b
commit dc8b2ae6d2
20 changed files with 357 additions and 12 deletions

View file

@ -549,6 +549,7 @@ phutil_register_library_map(array(
'DivinerPublisher' => 'applications/diviner/publisher/DivinerPublisher.php',
'DivinerRenderer' => 'applications/diviner/renderer/DivinerRenderer.php',
'DivinerReturnTableView' => 'applications/diviner/view/DivinerReturnTableView.php',
'DivinerSchemaSpec' => 'applications/diviner/storage/DivinerSchemaSpec.php',
'DivinerSectionView' => 'applications/diviner/view/DivinerSectionView.php',
'DivinerStaticPublisher' => 'applications/diviner/publisher/DivinerStaticPublisher.php',
'DivinerSymbolRemarkupRule' => 'applications/diviner/markup/DivinerSymbolRemarkupRule.php',
@ -819,6 +820,7 @@ phutil_register_library_map(array(
'HeraldRuleTranscript' => 'applications/herald/storage/transcript/HeraldRuleTranscript.php',
'HeraldRuleTypeConfig' => 'applications/herald/config/HeraldRuleTypeConfig.php',
'HeraldRuleViewController' => 'applications/herald/controller/HeraldRuleViewController.php',
'HeraldSchemaSpec' => 'applications/herald/storage/HeraldSchemaSpec.php',
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
'HeraldTransactionQuery' => 'applications/herald/query/HeraldTransactionQuery.php',
'HeraldTranscript' => 'applications/herald/storage/transcript/HeraldTranscript.php',
@ -1572,6 +1574,7 @@ phutil_register_library_map(array(
'PhabricatorFactManagementStatusWorkflow' => 'applications/fact/management/PhabricatorFactManagementStatusWorkflow.php',
'PhabricatorFactManagementWorkflow' => 'applications/fact/management/PhabricatorFactManagementWorkflow.php',
'PhabricatorFactRaw' => 'applications/fact/storage/PhabricatorFactRaw.php',
'PhabricatorFactSchemaSpec' => 'applications/fact/storage/PhabricatorFactSchemaSpec.php',
'PhabricatorFactSimpleSpec' => 'applications/fact/spec/PhabricatorFactSimpleSpec.php',
'PhabricatorFactSpec' => 'applications/fact/spec/PhabricatorFactSpec.php',
'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php',
@ -1896,6 +1899,7 @@ phutil_register_library_map(array(
'PhabricatorOwnersPackageQuery' => 'applications/owners/query/PhabricatorOwnersPackageQuery.php',
'PhabricatorOwnersPackageTestCase' => 'applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php',
'PhabricatorOwnersPath' => 'applications/owners/storage/PhabricatorOwnersPath.php',
'PhabricatorOwnersSchemaSpec' => 'applications/owners/storage/PhabricatorOwnersSchemaSpec.php',
'PhabricatorPHDConfigOptions' => 'applications/config/option/PhabricatorPHDConfigOptions.php',
'PhabricatorPHID' => 'applications/phid/storage/PhabricatorPHID.php',
'PhabricatorPHIDConstants' => 'applications/phid/PhabricatorPHIDConstants.php',
@ -3386,6 +3390,7 @@ phutil_register_library_map(array(
'DivinerParameterTableView' => 'AphrontTagView',
'DivinerPublishCache' => 'DivinerDiskCache',
'DivinerReturnTableView' => 'AphrontTagView',
'DivinerSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'DivinerSectionView' => 'AphrontTagView',
'DivinerStaticPublisher' => 'DivinerPublisher',
'DivinerSymbolRemarkupRule' => 'PhutilRemarkupRule',
@ -3668,7 +3673,7 @@ phutil_register_library_map(array(
'HarbormasterWaitForPreviousBuildStepImplementation' => 'HarbormasterBuildStepImplementation',
'HarbormasterWorker' => 'PhabricatorWorker',
'HeraldAction' => 'HeraldDAO',
'HeraldApplyTranscript' => 'HeraldDAO',
'HeraldApplyTranscript' => 'Phobject',
'HeraldCommitAdapter' => 'HeraldAdapter',
'HeraldCondition' => 'HeraldDAO',
'HeraldController' => 'PhabricatorController',
@ -3708,6 +3713,7 @@ phutil_register_library_map(array(
'HeraldRuleTransaction' => 'PhabricatorApplicationTransaction',
'HeraldRuleTransactionComment' => 'PhabricatorApplicationTransactionComment',
'HeraldRuleViewController' => 'HeraldController',
'HeraldSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'HeraldTestConsoleController' => 'HeraldController',
'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'HeraldTranscript' => array(
@ -4523,6 +4529,7 @@ phutil_register_library_map(array(
'PhabricatorFactManagementStatusWorkflow' => 'PhabricatorFactManagementWorkflow',
'PhabricatorFactManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorFactRaw' => 'PhabricatorFactDAO',
'PhabricatorFactSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
'PhabricatorFeedApplication' => 'PhabricatorApplication',
@ -4847,6 +4854,7 @@ phutil_register_library_map(array(
'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorOwnersPackageTestCase' => 'PhabricatorTestCase',
'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO',
'PhabricatorOwnersSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorPHDConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPHPASTApplication' => 'PhabricatorApplication',
'PhabricatorPHPMailerConfigOptions' => 'PhabricatorApplicationConfigOptions',

View file

@ -13,6 +13,12 @@ final class DivinerLiveAtom extends DivinerDAO {
'content' => self::SERIALIZATION_JSON,
'atomData' => self::SERIALIZATION_JSON,
),
self::CONFIG_KEY_SCHEMA => array(
'symbolPHID' => array(
'columns' => array('symbolPHID'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

@ -13,6 +13,20 @@ final class DivinerLiveBook extends DivinerDAO
self::CONFIG_SERIALIZATION => array(
'configurationData' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'name' => array(
'columns' => array('name'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

@ -27,6 +27,54 @@ final class DivinerLiveSymbol extends DivinerDAO
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'context' => 'text255?',
'type' => 'text32',
'name' => 'text255',
'atomIndex' => 'uint32',
'identityHash' => 'bytes12',
'graphHash' => 'bytes64?',
'title' => 'text?',
'titleSlugHash' => 'bytes12?',
'groupName' => 'text255?',
'summary' => 'text?',
'isDocumentable' => 'bool',
'nodeHash' => 'bytes64?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'identityHash' => array(
'columns' => array('identityHash'),
'unique' => true,
),
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'graphHash' => array(
'columns' => array('graphHash'),
'unique' => true,
),
'nodeHash' => array(
'columns' => array('nodeHash'),
'unique' => true,
),
'bookPHID' => array(
'columns' => array(
'bookPHID',
'type',
'name(64)',
'context(64)',
'atomIndex',
),
),
'name' => array(
'columns' => array('name'),
),
'key_slug' => array(
'columns' => array('titleSlugHash'),
),
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,9 @@
<?php
final class DivinerSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('DivinerDAO');
}
}

View file

@ -2,9 +2,25 @@
final class PhabricatorFactAggregate extends PhabricatorFactDAO {
protected $id;
protected $factType;
protected $objectPHID;
protected $valueX;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'id' => null,
'factType' => 'text32',
'valueX' => 'uint64',
),
self::CONFIG_KEY_SCHEMA => array(
'PRIMARY' => null,
'factType' => array(
'columns' => array('factType', 'objectPHID'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
}

View file

@ -2,8 +2,22 @@
final class PhabricatorFactCursor extends PhabricatorFactDAO {
protected $id;
protected $name;
protected $position;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text64',
'position' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
'name' => array(
'columns' => array('name'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
}

View file

@ -5,7 +5,6 @@
*/
final class PhabricatorFactRaw extends PhabricatorFactDAO {
protected $id;
protected $factType;
protected $objectPHID;
protected $objectA;
@ -13,4 +12,29 @@ final class PhabricatorFactRaw extends PhabricatorFactDAO {
protected $valueY;
protected $epoch;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'id' => null,
'factType' => 'text32',
'objectA' => 'phid',
'valueX' => 'sint64',
'valueY' => 'sint64',
),
self::CONFIG_KEY_SCHEMA => array(
'PRIMARY' => null,
'objectPHID' => array(
'columns' => array('objectPHID'),
),
'factType' => array(
'columns' => array('factType', 'epoch'),
),
'factType_2' => array(
'columns' => array('factType', 'objectA'),
),
),
) + parent::getConfiguration();
}
}

View file

@ -0,0 +1,9 @@
<?php
final class PhabricatorFactSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorFactDAO');
}
}

View file

@ -13,6 +13,15 @@ final class HeraldAction extends HeraldDAO {
'target' => self::SERIALIZATION_JSON,
),
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'action' => 'text255',
'target' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'ruleID' => array(
'columns' => array('ruleID'),
),
),
) + parent::getConfiguration();
}

View file

@ -14,6 +14,16 @@ final class HeraldCondition extends HeraldDAO {
'value' => self::SERIALIZATION_JSON,
),
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'fieldName' => 'text255',
'fieldCondition' => 'text255',
'value' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'ruleID' => array(
'columns' => array('ruleID'),
),
),
) + parent::getConfiguration();
}

View file

@ -31,6 +31,33 @@ final class HeraldRule extends HeraldDAO
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'contentType' => 'text255',
'mustMatchAll' => 'bool',
'configVersion' => 'uint32',
'repetitionPolicy' => 'uint32',
'ruleType' => 'text255',
'isDisabled' => 'uint32',
'triggerObjectPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'authorPHID' => array(
'columns' => array('authorPHID', 'name'),
'unique' => true,
),
'IDX_RULE_TYPE' => array(
'columns' => array('ruleType'),
),
'key_trigger' => array(
'columns' => array('triggerObjectPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -7,4 +7,18 @@ final class HeraldRuleEdit extends HeraldDAO {
protected $ruleName;
protected $action;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'ruleName' => 'text255',
'action' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'ruleID' => array(
'columns' => array('ruleID', 'dateCreated'),
),
),
) + parent::getConfiguration();
}
}

View file

@ -0,0 +1,44 @@
<?php
final class HeraldSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('HeraldDAO');
$this->buildTransactionSchema(
new HeraldRuleTransaction(),
new HeraldRuleTransactionComment());
$this->buildRawSchema(
id(new HeraldRule())->getApplicationName(),
HeraldRule::TABLE_RULE_APPLIED,
array(
'ruleID' => 'id',
'phid' => 'phid',
),
array(
'PRIMARY' => array(
'columns' => array('ruleID', 'phid'),
'unique' => true,
),
'phid' => array(
'columns' => array('phid'),
),
));
$this->buildRawSchema(
id(new HeraldRule())->getApplicationName(),
HeraldTranscript::TABLE_SAVED_HEADER,
array(
'phid' => 'phid',
'header' => 'text',
),
array(
'PRIMARY' => array(
'columns' => array('phid'),
'unique' => true,
),
));
}
}

View file

@ -1,17 +1,17 @@
<?php
final class HeraldApplyTranscript extends HeraldDAO {
final class HeraldApplyTranscript extends Phobject {
protected $action;
protected $target;
private $action;
private $target;
protected $ruleID;
protected $effector;
private $ruleID;
private $effector;
protected $reason;
private $reason;
protected $applied;
protected $appliedReason;
private $applied;
private $appliedReason;
public function __construct(
HeraldEffect $effect,
@ -25,29 +25,58 @@ final class HeraldApplyTranscript extends HeraldDAO {
$this->setReason($effect->getReason());
$this->setApplied($applied);
$this->setAppliedReason($reason);
}
public function setAction($action) {
$this->action = $action;
return $this;
}
public function getAction() {
return $this->action;
}
public function setTarget($target) {
$this->target = $target;
return $this;
}
public function getTarget() {
return $this->target;
}
public function setRuleID($rule_id) {
$this->ruleID = $rule_id;
return $this;
}
public function getRuleID() {
return $this->ruleID;
}
public function setEffector($effector) {
$this->effector = $effector;
return $this;
}
public function getEffector() {
return $this->effector;
}
public function setReason($reason) {
$this->reason = $reason;
return $this;
}
public function getReason() {
return $this->reason;
}
public function setApplied($applied) {
$this->applied = $applied;
return $this;
}
public function getApplied() {
return $this->applied;
}

View file

@ -100,6 +100,25 @@ final class HeraldTranscript extends HeraldDAO
'conditionTranscripts' => true,
'applyTranscripts' => true,
),
self::CONFIG_COLUMN_SCHEMA => array(
'time' => 'epoch',
'host' => 'text255',
'duration' => 'double',
'dryRun' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'objectPHID' => array(
'columns' => array('objectPHID'),
),
'garbageCollected' => array(
'columns' => array('garbageCollected', 'time'),
),
),
) + parent::getConfiguration();
}

View file

@ -12,6 +12,15 @@ final class PhabricatorOwnersOwner extends PhabricatorOwnersDAO {
public function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_KEY_SCHEMA => array(
'packageID' => array(
'columns' => array('packageID', 'userPHID'),
'unique' => true,
),
'userPHID' => array(
'columns' => array('userPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -38,6 +38,24 @@ final class PhabricatorOwnersPackage extends PhabricatorOwnersDAO
// This information is better available from the history table.
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'originalName' => 'text255',
'description' => 'text',
'primaryOwnerPHID' => 'phid?',
'auditingEnabled' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'name' => array(
'columns' => array('name'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

@ -10,6 +10,15 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO {
public function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'path' => 'text255',
'excluded' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'packageID' => array(
'columns' => array('packageID'),
),
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,9 @@
<?php
final class PhabricatorOwnersSchemaSpec extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorOwnersDAO');
}
}