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

Generate reasonable expected schemata for Chatlog, Conduit, Config, Countdown, Daemons

Summary: Ref T1191. Fills in some more of the databases. Nothing very notable here. I didn't encounter any issues or overlong keys.

Test Plan: Used web UI to click around and verify expected schemata match up against actual schemata well.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10516
This commit is contained in:
epriestley 2014-09-18 11:15:29 -07:00
parent 3238f1e091
commit 1ead50c2cc
17 changed files with 165 additions and 0 deletions

View file

@ -1310,6 +1310,7 @@ phutil_register_library_map(array(
'PhabricatorChatLogEvent' => 'applications/chatlog/storage/PhabricatorChatLogEvent.php', 'PhabricatorChatLogEvent' => 'applications/chatlog/storage/PhabricatorChatLogEvent.php',
'PhabricatorChatLogEventType' => 'applications/chatlog/constants/PhabricatorChatLogEventType.php', 'PhabricatorChatLogEventType' => 'applications/chatlog/constants/PhabricatorChatLogEventType.php',
'PhabricatorChatLogQuery' => 'applications/chatlog/query/PhabricatorChatLogQuery.php', 'PhabricatorChatLogQuery' => 'applications/chatlog/query/PhabricatorChatLogQuery.php',
'PhabricatorChatLogSchemaSpec' => 'applications/chatlog/storage/PhabricatorChatLogSchemaSpec.php',
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php', 'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php', 'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php', 'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php',
@ -1328,6 +1329,7 @@ phutil_register_library_map(array(
'PhabricatorConduitLogQuery' => 'applications/conduit/query/PhabricatorConduitLogQuery.php', 'PhabricatorConduitLogQuery' => 'applications/conduit/query/PhabricatorConduitLogQuery.php',
'PhabricatorConduitMethodCallLog' => 'applications/conduit/storage/PhabricatorConduitMethodCallLog.php', 'PhabricatorConduitMethodCallLog' => 'applications/conduit/storage/PhabricatorConduitMethodCallLog.php',
'PhabricatorConduitMethodQuery' => 'applications/conduit/query/PhabricatorConduitMethodQuery.php', 'PhabricatorConduitMethodQuery' => 'applications/conduit/query/PhabricatorConduitMethodQuery.php',
'PhabricatorConduitSchemaSpec' => 'applications/conduit/storage/PhabricatorConduitSchemaSpec.php',
'PhabricatorConduitSearchEngine' => 'applications/conduit/query/PhabricatorConduitSearchEngine.php', 'PhabricatorConduitSearchEngine' => 'applications/conduit/query/PhabricatorConduitSearchEngine.php',
'PhabricatorConduitTokenController' => 'applications/conduit/controller/PhabricatorConduitTokenController.php', 'PhabricatorConduitTokenController' => 'applications/conduit/controller/PhabricatorConduitTokenController.php',
'PhabricatorConfigAllController' => 'applications/config/controller/PhabricatorConfigAllController.php', 'PhabricatorConfigAllController' => 'applications/config/controller/PhabricatorConfigAllController.php',
@ -1367,6 +1369,7 @@ phutil_register_library_map(array(
'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php',
'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php', 'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php',
'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php', 'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php',
'PhabricatorConfigSettingsSchemaSpec' => 'applications/config/storage/PhabricatorConfigSettingsSchemaSpec.php',
'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php', 'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php',
'PhabricatorConfigStackSource' => 'infrastructure/env/PhabricatorConfigStackSource.php', 'PhabricatorConfigStackSource' => 'infrastructure/env/PhabricatorConfigStackSource.php',
'PhabricatorConfigStorageSchema' => 'applications/config/schema/PhabricatorConfigStorageSchema.php', 'PhabricatorConfigStorageSchema' => 'applications/config/schema/PhabricatorConfigStorageSchema.php',
@ -1393,6 +1396,7 @@ phutil_register_library_map(array(
'PhabricatorCountdownListController' => 'applications/countdown/controller/PhabricatorCountdownListController.php', 'PhabricatorCountdownListController' => 'applications/countdown/controller/PhabricatorCountdownListController.php',
'PhabricatorCountdownQuery' => 'applications/countdown/query/PhabricatorCountdownQuery.php', 'PhabricatorCountdownQuery' => 'applications/countdown/query/PhabricatorCountdownQuery.php',
'PhabricatorCountdownRemarkupRule' => 'applications/countdown/remarkup/PhabricatorCountdownRemarkupRule.php', 'PhabricatorCountdownRemarkupRule' => 'applications/countdown/remarkup/PhabricatorCountdownRemarkupRule.php',
'PhabricatorCountdownSchemaSpec' => 'applications/countdown/storage/PhabricatorCountdownSchemaSpec.php',
'PhabricatorCountdownSearchEngine' => 'applications/countdown/query/PhabricatorCountdownSearchEngine.php', 'PhabricatorCountdownSearchEngine' => 'applications/countdown/query/PhabricatorCountdownSearchEngine.php',
'PhabricatorCountdownView' => 'applications/countdown/view/PhabricatorCountdownView.php', 'PhabricatorCountdownView' => 'applications/countdown/view/PhabricatorCountdownView.php',
'PhabricatorCountdownViewController' => 'applications/countdown/controller/PhabricatorCountdownViewController.php', 'PhabricatorCountdownViewController' => 'applications/countdown/controller/PhabricatorCountdownViewController.php',
@ -1438,6 +1442,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonManagementStopWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php', 'PhabricatorDaemonManagementStopWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php',
'PhabricatorDaemonManagementWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementWorkflow.php', 'PhabricatorDaemonManagementWorkflow' => 'applications/daemon/management/PhabricatorDaemonManagementWorkflow.php',
'PhabricatorDaemonReference' => 'infrastructure/daemon/control/PhabricatorDaemonReference.php', 'PhabricatorDaemonReference' => 'infrastructure/daemon/control/PhabricatorDaemonReference.php',
'PhabricatorDaemonSchemaSpec' => 'applications/daemon/storage/PhabricatorDaemonSchemaSpec.php',
'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php', 'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php',
'PhabricatorDaemonsApplication' => 'applications/daemon/application/PhabricatorDaemonsApplication.php', 'PhabricatorDaemonsApplication' => 'applications/daemon/application/PhabricatorDaemonsApplication.php',
'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php', 'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php',
@ -4203,6 +4208,7 @@ phutil_register_library_map(array(
), ),
'PhabricatorChatLogEventType' => 'PhabricatorChatLogConstants', 'PhabricatorChatLogEventType' => 'PhabricatorChatLogConstants',
'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorChatLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorChatLogSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField', 'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitCustomField' => 'PhabricatorCustomField', 'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine',
@ -4224,6 +4230,7 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'PhabricatorConduitMethodQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorConduitMethodQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorConduitSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorConduitSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorConduitSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorConduitTokenController' => 'PhabricatorConduitController', 'PhabricatorConduitTokenController' => 'PhabricatorConduitController',
'PhabricatorConfigAllController' => 'PhabricatorConfigController', 'PhabricatorConfigAllController' => 'PhabricatorConfigController',
@ -4267,6 +4274,7 @@ phutil_register_library_map(array(
'PhabricatorConfigSchemaQuery' => 'Phobject', 'PhabricatorConfigSchemaQuery' => 'Phobject',
'PhabricatorConfigSchemaSpec' => 'Phobject', 'PhabricatorConfigSchemaSpec' => 'Phobject',
'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema', 'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema',
'PhabricatorConfigSettingsSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorConfigStackSource' => 'PhabricatorConfigSource', 'PhabricatorConfigStackSource' => 'PhabricatorConfigSource',
'PhabricatorConfigStorageSchema' => 'Phobject', 'PhabricatorConfigStorageSchema' => 'Phobject',
'PhabricatorConfigTableSchema' => 'PhabricatorConfigStorageSchema', 'PhabricatorConfigTableSchema' => 'PhabricatorConfigStorageSchema',
@ -4294,6 +4302,7 @@ phutil_register_library_map(array(
'PhabricatorCountdownListController' => 'PhabricatorCountdownController', 'PhabricatorCountdownListController' => 'PhabricatorCountdownController',
'PhabricatorCountdownQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorCountdownQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorCountdownRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PhabricatorCountdownRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorCountdownSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorCountdownSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorCountdownSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorCountdownView' => 'AphrontTagView', 'PhabricatorCountdownView' => 'AphrontTagView',
'PhabricatorCountdownViewController' => 'PhabricatorCountdownController', 'PhabricatorCountdownViewController' => 'PhabricatorCountdownController',
@ -4338,6 +4347,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonManagementStatusWorkflow' => 'PhabricatorDaemonManagementWorkflow', 'PhabricatorDaemonManagementStatusWorkflow' => 'PhabricatorDaemonManagementWorkflow',
'PhabricatorDaemonManagementStopWorkflow' => 'PhabricatorDaemonManagementWorkflow', 'PhabricatorDaemonManagementStopWorkflow' => 'PhabricatorDaemonManagementWorkflow',
'PhabricatorDaemonManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorDaemonManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorDaemonSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorDaemonTaskGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorDaemonTaskGarbageCollector' => 'PhabricatorGarbageCollector',
'PhabricatorDaemonsApplication' => 'PhabricatorApplication', 'PhabricatorDaemonsApplication' => 'PhabricatorApplication',
'PhabricatorDashboard' => array( 'PhabricatorDashboard' => array(

View file

@ -10,6 +10,21 @@ final class PhabricatorChatLogChannel
protected $viewPolicy; protected $viewPolicy;
protected $editPolicy; protected $editPolicy;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'serviceName' => 'text64',
'serviceType' => 'text32',
'channelName' => 'text64',
),
self::CONFIG_KEY_SCHEMA => array(
'key_channel' => array(
'columns' => array('channelName', 'serviceType', 'serviceName'),
),
),
) + parent::getConfiguration();
}
public function getCapabilities() { public function getCapabilities() {
return array( return array(
PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -16,6 +16,11 @@ final class PhabricatorChatLogEvent
public function getConfiguration() { public function getConfiguration() {
return array( return array(
self::CONFIG_TIMESTAMPS => false, self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'author' => 'text64',
'type' => 'text4',
'message' => 'text',
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }

View file

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

View file

@ -5,4 +5,20 @@ final class PhabricatorConduitCertificateToken extends PhabricatorConduitDAO {
protected $userPHID; protected $userPHID;
protected $token; protected $token;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'token' => 'text64?',
),
self::CONFIG_KEY_SCHEMA => array(
'userPHID' => array(
'columns' => array('userPHID'),
),
'token' => array(
'columns' => array('token'),
),
),
) + parent::getConfiguration();
}
} }

View file

@ -7,4 +7,15 @@ final class PhabricatorConduitConnectionLog extends PhabricatorConduitDAO {
protected $clientDescription; protected $clientDescription;
protected $username; protected $username;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'client' => 'text255?',
'clientVersion' => 'text255?',
'clientDescription' => 'text255?',
'username' => 'text255?',
),
) + parent::getConfiguration();
}
} }

View file

@ -10,6 +10,19 @@ final class PhabricatorConduitMethodCallLog
protected $error; protected $error;
protected $duration; protected $duration;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'id' => 'id64',
'connectionID' => 'id64?',
'method' => 'text255',
'error' => 'text255',
'duration' => 'uint64',
'callerPHID' => 'phid?',
),
) + parent::getConfiguration();
}
/* -( PhabricatorPolicyInterface )----------------------------------------- */ /* -( PhabricatorPolicyInterface )----------------------------------------- */

View file

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

View file

@ -158,6 +158,7 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$column_type = 'int(10) unsigned'; $column_type = 'int(10) unsigned';
break; break;
case 'id64': case 'id64':
case 'uint64':
$column_type = 'bigint(20) unsigned'; $column_type = 'bigint(20) unsigned';
break; break;
case 'phid': case 'phid':
@ -166,6 +167,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$charset = 'binary'; $charset = 'binary';
$collation = 'binary'; $collation = 'binary';
break; break;
case 'bytes40':
$column_type = 'char(40)';
$charset = 'binary';
$collation = 'binary';
break;
case 'bytes12': case 'bytes12':
$column_type = 'char(12)'; $column_type = 'char(12)';
$charset = 'binary'; $charset = 'binary';
@ -176,6 +182,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$charset = 'binary'; $charset = 'binary';
$collation = 'binary'; $collation = 'binary';
break; break;
case 'text255':
$column_type = 'varchar(255)';
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text128': case 'text128':
$column_type = 'varchar(128)'; $column_type = 'varchar(128)';
$charset = $this->getUTF8Charset(); $charset = $this->getUTF8Charset();
@ -201,6 +212,16 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$charset = $this->getUTF8Charset(); $charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation(); $collation = $this->getUTF8Collation();
break; break;
case 'text8':
$column_type = 'varchar(8)';
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text4':
$column_type = 'varchar(4)';
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text': case 'text':
$column_type = 'longtext'; $column_type = 'longtext';
$charset = $this->getUTF8Charset(); $charset = $this->getUTF8Charset();

View file

@ -14,6 +14,16 @@ final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'value' => self::SERIALIZATION_JSON, 'value' => self::SERIALIZATION_JSON,
), ),
self::CONFIG_COLUMN_SCHEMA => array(
'namespace' => 'text64',
'configKey' => 'text64',
'isDeleted' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_name' => array(
'columns' => array('namespace', 'configKey'),
),
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }

View file

@ -0,0 +1,11 @@
<?php
final class PhabricatorConfigSettingsSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorConfigEntryDAO');
$this->buildTransactionSchema(new PhabricatorConfigTransaction());
}
}

View file

@ -27,6 +27,9 @@ final class PhabricatorCountdown
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(
'title' => 'text255',
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }

View file

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

View file

@ -24,6 +24,13 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
'argv' => self::SERIALIZATION_JSON, 'argv' => self::SERIALIZATION_JSON,
'explicitArgv' => self::SERIALIZATION_JSON, 'explicitArgv' => self::SERIALIZATION_JSON,
), ),
self::CONFIG_COLUMN_SCHEMA => array(
'daemon' => 'text255',
'host' => 'text255',
'pid' => 'uint32',
'envHash' => 'bytes40',
'status' => 'text8',
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }

View file

@ -10,6 +10,10 @@ final class PhabricatorDaemonLogEvent extends PhabricatorDaemonDAO {
public function getConfiguration() { public function getConfiguration() {
return array( return array(
self::CONFIG_TIMESTAMPS => false, self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'logType' => 'text4',
'message' => 'text',
),
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }

View file

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

View file

@ -1742,6 +1742,7 @@ abstract class LiskDAO {
'phid' => 'phid', 'phid' => 'phid',
'viewPolicy' => 'policy', 'viewPolicy' => 'policy',
'editPolicy' => 'policy', 'editPolicy' => 'policy',
'epoch' => 'epoch',
'dateCreated' => 'epoch', 'dateCreated' => 'epoch',
'dateModified' => 'epoch', 'dateModified' => 'epoch',
); );