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

Generate expected schemata for Workers, XHProf, PHPAAST, Tokens, System, Slowvote

Summary: T1191. Nothing very notable here.

Test Plan: Saw more blue in web UI.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10522
This commit is contained in:
epriestley 2014-09-19 05:45:24 -07:00
parent e9ac3f436a
commit 7499cb24ce
19 changed files with 203 additions and 0 deletions

View file

@ -2266,6 +2266,7 @@ phutil_register_library_map(array(
'PhabricatorSlowvotePollController' => 'applications/slowvote/controller/PhabricatorSlowvotePollController.php',
'PhabricatorSlowvotePollPHIDType' => 'applications/slowvote/phid/PhabricatorSlowvotePollPHIDType.php',
'PhabricatorSlowvoteQuery' => 'applications/slowvote/query/PhabricatorSlowvoteQuery.php',
'PhabricatorSlowvoteSchemaSpec' => 'applications/slowvote/storage/PhabricatorSlowvoteSchemaSpec.php',
'PhabricatorSlowvoteSearchEngine' => 'applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php',
'PhabricatorSlowvoteTransaction' => 'applications/slowvote/storage/PhabricatorSlowvoteTransaction.php',
'PhabricatorSlowvoteTransactionComment' => 'applications/slowvote/storage/PhabricatorSlowvoteTransactionComment.php',
@ -2322,6 +2323,7 @@ phutil_register_library_map(array(
'PhabricatorSystemRemoveDestroyWorkflow' => 'applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php',
'PhabricatorSystemRemoveLogWorkflow' => 'applications/system/management/PhabricatorSystemRemoveLogWorkflow.php',
'PhabricatorSystemRemoveWorkflow' => 'applications/system/management/PhabricatorSystemRemoveWorkflow.php',
'PhabricatorSystemSchemaSpec' => 'applications/system/storage/PhabricatorSystemSchemaSpec.php',
'PhabricatorSystemSelectEncodingController' => 'applications/system/controller/PhabricatorSystemSelectEncodingController.php',
'PhabricatorSystemSelectHighlightController' => 'applications/system/controller/PhabricatorSystemSelectHighlightController.php',
'PhabricatorTaskmasterDaemon' => 'infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php',
@ -2349,6 +2351,7 @@ phutil_register_library_map(array(
'PhabricatorTokenQuery' => 'applications/tokens/query/PhabricatorTokenQuery.php',
'PhabricatorTokenReceiverInterface' => 'applications/tokens/interface/PhabricatorTokenReceiverInterface.php',
'PhabricatorTokenReceiverQuery' => 'applications/tokens/query/PhabricatorTokenReceiverQuery.php',
'PhabricatorTokenSchemaSpec' => 'applications/tokens/storage/PhabricatorTokenSchemaSpec.php',
'PhabricatorTokenTokenPHIDType' => 'applications/tokens/phid/PhabricatorTokenTokenPHIDType.php',
'PhabricatorTokenUIEventListener' => 'applications/tokens/event/PhabricatorTokenUIEventListener.php',
'PhabricatorTokensApplication' => 'applications/tokens/application/PhabricatorTokensApplication.php',
@ -2417,6 +2420,7 @@ phutil_register_library_map(array(
'PhabricatorWorkerDAO' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerDAO.php',
'PhabricatorWorkerLeaseQuery' => 'infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php',
'PhabricatorWorkerPermanentFailureException' => 'infrastructure/daemon/workers/exception/PhabricatorWorkerPermanentFailureException.php',
'PhabricatorWorkerSchemaSpec' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerSchemaSpec.php',
'PhabricatorWorkerTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php',
'PhabricatorWorkerTaskData' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerTaskData.php',
'PhabricatorWorkerTaskDetailController' => 'applications/daemon/controller/PhabricatorWorkerTaskDetailController.php',
@ -2434,6 +2438,7 @@ phutil_register_library_map(array(
'PhabricatorXHPASTViewPanelController' => 'applications/phpast/controller/PhabricatorXHPASTViewPanelController.php',
'PhabricatorXHPASTViewParseTree' => 'applications/phpast/storage/PhabricatorXHPASTViewParseTree.php',
'PhabricatorXHPASTViewRunController' => 'applications/phpast/controller/PhabricatorXHPASTViewRunController.php',
'PhabricatorXHPASTViewSchemaSpec' => 'applications/phpast/storage/PhabricatorXHPASTViewSchemaSpec.php',
'PhabricatorXHPASTViewStreamController' => 'applications/phpast/controller/PhabricatorXHPASTViewStreamController.php',
'PhabricatorXHPASTViewTreeController' => 'applications/phpast/controller/PhabricatorXHPASTViewTreeController.php',
'PhabricatorXHProfApplication' => 'applications/xhprof/application/PhabricatorXHProfApplication.php',
@ -2445,6 +2450,7 @@ phutil_register_library_map(array(
'PhabricatorXHProfProfileView' => 'applications/xhprof/view/PhabricatorXHProfProfileView.php',
'PhabricatorXHProfSample' => 'applications/xhprof/storage/PhabricatorXHProfSample.php',
'PhabricatorXHProfSampleListController' => 'applications/xhprof/controller/PhabricatorXHProfSampleListController.php',
'PhabricatorXHProfSchemaSpec' => 'applications/xhprof/storage/PhabricatorXHProfSchemaSpec.php',
'PhabricatorYoutubeRemarkupRule' => 'infrastructure/markup/rule/PhabricatorYoutubeRemarkupRule.php',
'PhameBasicBlogSkin' => 'applications/phame/skins/PhameBasicBlogSkin.php',
'PhameBasicTemplateBlogSkin' => 'applications/phame/skins/PhameBasicTemplateBlogSkin.php',
@ -5239,6 +5245,7 @@ phutil_register_library_map(array(
'PhabricatorSlowvotePollController' => 'PhabricatorSlowvoteController',
'PhabricatorSlowvotePollPHIDType' => 'PhabricatorPHIDType',
'PhabricatorSlowvoteQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorSlowvoteSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorSlowvoteSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorSlowvoteTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorSlowvoteTransactionComment' => 'PhabricatorApplicationTransactionComment',
@ -5287,6 +5294,7 @@ phutil_register_library_map(array(
'PhabricatorSystemRemoveDestroyWorkflow' => 'PhabricatorSystemRemoveWorkflow',
'PhabricatorSystemRemoveLogWorkflow' => 'PhabricatorSystemRemoveWorkflow',
'PhabricatorSystemRemoveWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorSystemSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorSystemSelectEncodingController' => 'PhabricatorController',
'PhabricatorSystemSelectHighlightController' => 'PhabricatorController',
'PhabricatorTaskmasterDaemon' => 'PhabricatorDaemon',
@ -5316,6 +5324,7 @@ phutil_register_library_map(array(
'PhabricatorTokenLeaderController' => 'PhabricatorTokenController',
'PhabricatorTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorTokenReceiverQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorTokenSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorTokenTokenPHIDType' => 'PhabricatorPHIDType',
'PhabricatorTokenUIEventListener' => 'PhabricatorEventListener',
'PhabricatorTokensApplication' => 'PhabricatorApplication',
@ -5391,6 +5400,7 @@ phutil_register_library_map(array(
'PhabricatorWorkerDAO' => 'PhabricatorLiskDAO',
'PhabricatorWorkerLeaseQuery' => 'PhabricatorQuery',
'PhabricatorWorkerPermanentFailureException' => 'Exception',
'PhabricatorWorkerSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorWorkerTask' => 'PhabricatorWorkerDAO',
'PhabricatorWorkerTaskData' => 'PhabricatorWorkerDAO',
'PhabricatorWorkerTaskDetailController' => 'PhabricatorDaemonController',
@ -5408,6 +5418,7 @@ phutil_register_library_map(array(
'PhabricatorXHPASTViewPanelController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewParseTree' => 'PhabricatorXHPASTViewDAO',
'PhabricatorXHPASTViewRunController' => 'PhabricatorXHPASTViewController',
'PhabricatorXHPASTViewSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorXHPASTViewStreamController' => 'PhabricatorXHPASTViewPanelController',
'PhabricatorXHPASTViewTreeController' => 'PhabricatorXHPASTViewPanelController',
'PhabricatorXHProfApplication' => 'PhabricatorApplication',
@ -5419,6 +5430,7 @@ phutil_register_library_map(array(
'PhabricatorXHProfProfileView' => 'AphrontView',
'PhabricatorXHProfSample' => 'PhabricatorXHProfDAO',
'PhabricatorXHProfSampleListController' => 'PhabricatorXHProfController',
'PhabricatorXHProfSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorYoutubeRemarkupRule' => 'PhutilRemarkupRule',
'PhameBasicBlogSkin' => 'PhameBlogSkin',
'PhameBasicTemplateBlogSkin' => 'PhameBasicBlogSkin',

View file

@ -138,6 +138,21 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
));
}
public function buildCounterSchema(PhabricatorLiskDAO $object) {
$this->buildRawSchema(
$object->getApplicationName(),
PhabricatorLiskDAO::COUNTER_TABLE_NAME,
array(
'counterName' => 'text32',
'counterValue' => 'id64',
),
array(
'PRIMARY' => array(
'columns' => array('counterName'),
),
));
}
protected function getDatabase($name) {
$server = $this->getServer();
@ -274,6 +289,9 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
case 'bool':
$column_type = 'tinyint(1)';
break;
case 'double':
$column_type = 'double';
break;
default:
$column_type = pht('<unknown>');
$charset = pht('<unknown>');

View file

@ -6,4 +6,14 @@ final class PhabricatorXHPASTViewParseTree extends PhabricatorXHPASTViewDAO {
protected $input;
protected $stdout;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'authorPHID' => 'phid?',
'input' => 'text',
'stdout' => 'text',
),
) + parent::getConfiguration();
}
}

View file

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

View file

@ -5,4 +5,12 @@ final class PhabricatorSlowvoteOption extends PhabricatorSlowvoteDAO {
protected $pollID;
protected $name;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
),
) + parent::getConfiguration();
}
}

View file

@ -46,6 +46,20 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'question' => 'text255',
'responseVisibility' => 'uint32',
'shuffle' => 'uint32',
'method' => 'uint32',
'description' => 'text',
'isClosed' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
),
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,14 @@
<?php
final class PhabricatorSlowvoteSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorSlowvoteDAO');
$this->buildEdgeSchemata(new PhabricatorSlowvotePoll());
$this->buildTransactionSchema(
new PhabricatorSlowvoteTransaction(),
new PhabricatorSlowvoteTransactionComment());
}
}

View file

@ -11,6 +11,12 @@ final class PhabricatorSystemActionLog extends PhabricatorSystemDAO {
public function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'actorHash' => 'bytes12',
'actorIdentity' => 'text255',
'action' => 'text32',
'score' => 'double',
),
) + parent::getConfiguration();
}

View file

@ -11,6 +11,12 @@ final class PhabricatorSystemDestructionLog extends PhabricatorSystemDAO {
public function getConfiguration() {
return array(
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'objectClass' => 'text128',
'rootLogID' => 'id?',
'objectPHID' => 'phid?',
'objectMonogram' => 'text64?',
),
) + parent::getConfiguration();
}

View file

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

View file

@ -9,6 +9,14 @@ final class PhabricatorTokenCount extends PhabricatorTokenDAO {
return array(
self::CONFIG_IDS => self::IDS_MANUAL,
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'tokenCount' => 'uint32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_objectPHID' => array(
'columns' => array('objectPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -9,6 +9,16 @@ final class PhabricatorTokenGiven extends PhabricatorTokenDAO
private $object = self::ATTACHABLE;
public function getConfiguration() {
return array(
self::CONFIG_KEY_SCHEMA => array(
'key_all' => array(
'columns' => array('objectPHID', 'authorPHID'),
),
),
) + parent::getConfiguration();
}
public function attachObject(PhabricatorTokenReceiverInterface $object) {
$this->object = $object;
return $this;

View file

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

View file

@ -9,4 +9,23 @@ final class PhabricatorXHProfSample extends PhabricatorXHProfDAO {
protected $requestPath;
protected $controller;
protected $userPHID;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'sampleRate' => 'uint32',
'usTotal' => 'uint64',
'hostname' => 'text255?',
'requestPath' => 'text255?',
'controller' => 'text255?',
'userPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'filePHID' => array(
'columns' => array('filePHID'),
),
),
) + parent::getConfiguration();
}
}

View file

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

View file

@ -11,6 +11,11 @@ final class PhabricatorWorkerActiveTask extends PhabricatorWorkerTask {
return array(
self::CONFIG_IDS => self::IDS_COUNTER,
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_KEY_SCHEMA => array(
'dataID' => array(
'columns' => array('dataID'),
),
),
) + parent::getConfiguration();
}

View file

@ -9,6 +9,15 @@ final class PhabricatorWorkerArchiveTask extends PhabricatorWorkerTask {
protected $duration;
protected $result;
public function getConfiguration() {
$config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array(
'result' => 'uint32',
'duration' => 'uint64',
) + $config[self::CONFIG_COLUMN_SCHEMA];
return $config;
}
public function save() {
if ($this->getID() === null) {
throw new Exception('Trying to archive a task with no ID.');

View file

@ -0,0 +1,11 @@
<?php
final class PhabricatorWorkerSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorWorkerDAO');
$this->buildCounterSchema(new PhabricatorWorkerActiveTask());
}
}

View file

@ -14,6 +14,19 @@ abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO {
private $data;
private $executionException;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'taskClass' => 'text255',
'leaseOwner' => 'text255?',
'leaseExpires' => 'epoch?',
'failureCount' => 'uint32',
'failureTime' => 'epoch?',
'priority' => 'uint32',
),
) + parent::getConfiguration();
}
final public function setExecutionException(Exception $execution_exception) {
$this->executionException = $execution_exception;
return $this;