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

Generate expected schemata for MetaMTA, Nuance, MetaData, OAuthServer

Summary: Ref T1191. Handful of minor things here (T6150, T6149, T6148, T6147, T6146) but nothing very noteworthy.

Test Plan: Viewed web UI, saw fewer errors.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10527
This commit is contained in:
epriestley 2014-09-24 13:50:00 -07:00
parent cd4e3c6399
commit d6639b68d5
18 changed files with 273 additions and 0 deletions

View file

@ -992,6 +992,7 @@ phutil_register_library_map(array(
'NuanceRequestorTransactionComment' => 'applications/nuance/storage/NuanceRequestorTransactionComment.php',
'NuanceRequestorTransactionQuery' => 'applications/nuance/query/NuanceRequestorTransactionQuery.php',
'NuanceRequestorViewController' => 'applications/nuance/controller/NuanceRequestorViewController.php',
'NuanceSchemaSpec' => 'applications/nuance/storage/NuanceSchemaSpec.php',
'NuanceSource' => 'applications/nuance/storage/NuanceSource.php',
'NuanceSourceDefaultEditCapability' => 'applications/nuance/capability/NuanceSourceDefaultEditCapability.php',
'NuanceSourceDefaultViewCapability' => 'applications/nuance/capability/NuanceSourceDefaultViewCapability.php',
@ -1808,6 +1809,7 @@ phutil_register_library_map(array(
'PhabricatorMetaMTAReceivedMail' => 'applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php',
'PhabricatorMetaMTAReceivedMailProcessingException' => 'applications/metamta/exception/PhabricatorMetaMTAReceivedMailProcessingException.php',
'PhabricatorMetaMTAReceivedMailTestCase' => 'applications/metamta/storage/__tests__/PhabricatorMetaMTAReceivedMailTestCase.php',
'PhabricatorMetaMTASchemaSpec' => 'applications/metamta/storage/PhabricatorMetaMTASchemaSpec.php',
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
'PhabricatorMultiColumnExample' => 'applications/uiexample/examples/PhabricatorMultiColumnExample.php',
@ -1844,6 +1846,7 @@ phutil_register_library_map(array(
'PhabricatorOAuthClientListController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php',
'PhabricatorOAuthClientViewController' => 'applications/oauthserver/controller/client/PhabricatorOAuthClientViewController.php',
'PhabricatorOAuthResponse' => 'applications/oauthserver/PhabricatorOAuthResponse.php',
'PhabricatorOAuthSchemaSpec' => 'applications/oauthserver/storage/PhabricatorOAuthSchemaSpec.php',
'PhabricatorOAuthServer' => 'applications/oauthserver/PhabricatorOAuthServer.php',
'PhabricatorOAuthServerAccessToken' => 'applications/oauthserver/storage/PhabricatorOAuthServerAccessToken.php',
'PhabricatorOAuthServerApplication' => 'applications/oauthserver/application/PhabricatorOAuthServerApplication.php',
@ -2305,6 +2308,7 @@ phutil_register_library_map(array(
'PhabricatorStorageManagementUpgradeWorkflow' => 'infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php',
'PhabricatorStorageManagementWorkflow' => 'infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php',
'PhabricatorStoragePatch' => 'infrastructure/storage/management/PhabricatorStoragePatch.php',
'PhabricatorStorageSchemaSpec' => 'infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php',
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
'PhabricatorSubscribersQuery' => 'applications/subscriptions/query/PhabricatorSubscribersQuery.php',
'PhabricatorSubscriptionsApplication' => 'applications/subscriptions/application/PhabricatorSubscriptionsApplication.php',
@ -3892,6 +3896,7 @@ phutil_register_library_map(array(
'NuanceRequestorTransactionComment' => 'PhabricatorApplicationTransactionComment',
'NuanceRequestorTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'NuanceRequestorViewController' => 'NuanceController',
'NuanceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'NuanceSource' => array(
'NuanceDAO',
'PhabricatorPolicyInterface',
@ -4738,6 +4743,7 @@ phutil_register_library_map(array(
'PhabricatorMetaMTAReceivedMail' => 'PhabricatorMetaMTADAO',
'PhabricatorMetaMTAReceivedMailProcessingException' => 'Exception',
'PhabricatorMetaMTAReceivedMailTestCase' => 'PhabricatorTestCase',
'PhabricatorMetaMTASchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
'PhabricatorMultiColumnExample' => 'PhabricatorUIExample',
@ -4778,6 +4784,7 @@ phutil_register_library_map(array(
'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientController',
'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientController',
'PhabricatorOAuthResponse' => 'AphrontResponse',
'PhabricatorOAuthSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO',
'PhabricatorOAuthServerApplication' => 'PhabricatorApplication',
'PhabricatorOAuthServerAuthController' => 'PhabricatorAuthController',
@ -5283,6 +5290,7 @@ phutil_register_library_map(array(
'PhabricatorStorageManagementStatusWorkflow' => 'PhabricatorStorageManagementWorkflow',
'PhabricatorStorageManagementUpgradeWorkflow' => 'PhabricatorStorageManagementWorkflow',
'PhabricatorStorageManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
'PhabricatorSubscriptionsApplication' => 'PhabricatorApplication',
'PhabricatorSubscriptionsEditController' => 'PhabricatorController',

View file

@ -271,6 +271,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text40':
$column_type = 'varchar(40)';
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text32':
$column_type = 'varchar(32)';
$charset = $this->getUTF8Charset();

View file

@ -17,6 +17,26 @@ final class PhabricatorMetaMTAMailingList extends PhabricatorMetaMTADAO
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'email' => 'text255',
'uri' => 'text255?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'email' => array(
'columns' => array('email'),
'unique' => true,
),
'name' => array(
'columns' => array('name'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

@ -32,6 +32,22 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
self::CONFIG_SERIALIZATION => array(
'parameters' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'status' => 'text255',
'message' => 'text',
'relatedPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'status' => array(
'columns' => array('status'),
),
'relatedPHID' => array(
'columns' => array('relatedPHID'),
),
'key_created' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();
}

View file

@ -19,6 +19,27 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
'bodies' => self::SERIALIZATION_JSON,
'attachments' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'relatedPHID' => 'phid?',
'authorPHID' => 'phid?',
'message' => 'text?',
'messageIDHash' => 'bytes12',
'status' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'relatedPHID' => array(
'columns' => array('relatedPHID'),
),
'authorPHID' => array(
'columns' => array('authorPHID'),
),
'key_messageIDHash' => array(
'columns' => array('messageIDHash'),
),
'key_created' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,14 @@
<?php
final class PhabricatorMetaMTASchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorMetaMTADAO');
$this->buildLiskSchemata('PhabricatorSMSDAO');
$this->buildEdgeSchemata(
new PhabricatorMetaMTAMail());
}
}

View file

@ -22,12 +22,31 @@ final class NuanceItem
->setDateNuanced(time())
->setStatus(NuanceItem::STATUS_OPEN);
}
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_SERIALIZATION => array(
'data' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'ownerPHID' => 'phid?',
'sourceLabel' => 'text255?',
'status' => 'uint32',
'mailKey' => 'bytes20',
'dateNuanced' => 'epoch',
),
self::CONFIG_KEY_SCHEMA => array(
'key_source' => array(
'columns' => array('sourcePHID', 'status', 'dateNuanced'),
),
'key_owner' => array(
'columns' => array('ownerPHID', 'status', 'dateNuanced'),
),
'key_contacter' => array(
'columns' => array('requestorPHID', 'status', 'dateNuanced'),
),
),
) + parent::getConfiguration();
}

View file

@ -12,6 +12,10 @@ final class NuanceQueue
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255?',
'mailKey' => 'bytes20',
),
) + parent::getConfiguration();
}

View file

@ -8,5 +8,22 @@ final class NuanceQueueItem
protected $itemStatus;
protected $itemDateNuanced;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'itemStatus' => 'uint32',
'itemDateNuanced' => 'epoch',
),
self::CONFIG_KEY_SCHEMA => array(
'key_one_per_queue' => array(
'columns' => array('itemPHID', 'queuePHID'),
'unique' => true,
),
'key_queue' => array(
'columns' => array('queuePHID', 'itemStatus', 'itemDateNuanced'),
),
),
) + parent::getConfiguration();
}
}

View file

@ -0,0 +1,27 @@
<?php
final class NuanceSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('NuanceDAO');
$this->buildEdgeSchemata(new NuanceItem());
$this->buildTransactionSchema(
new NuanceItemTransaction(),
new NuanceItemTransactionComment());
$this->buildTransactionSchema(
new NuanceQueueTransaction(),
new NuanceQueueTransactionComment());
$this->buildTransactionSchema(
new NuanceRequestorTransaction(),
new NuanceRequestorTransactionComment());
$this->buildTransactionSchema(
new NuanceSourceTransaction(),
new NuanceSourceTransactionComment());
}
}

View file

@ -16,6 +16,16 @@ final class NuanceSource extends NuanceDAO
self::CONFIG_SERIALIZATION => array(
'data' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255?',
'type' => 'text32',
'mailKey' => 'bytes20',
),
self::CONFIG_KEY_SCHEMA => array(
'key_type' => array(
'columns' => array('type', 'dateModified'),
),
),
) + parent::getConfiguration();
}

View file

@ -23,6 +23,20 @@ final class PhabricatorOAuthClientAuthorization
self::CONFIG_SERIALIZATION => array(
'scope' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'scope' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'userPHID' => array(
'columns' => array('userPHID', 'clientPHID'),
'unique' => true,
),
),
) + parent::getConfiguration();
}

View file

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

View file

@ -7,4 +7,19 @@ final class PhabricatorOAuthServerAccessToken
protected $token;
protected $userPHID;
protected $clientPHID;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'token' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'token' => array(
'columns' => array('token'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
}

View file

@ -9,4 +9,21 @@ final class PhabricatorOAuthServerAuthorizationCode
protected $clientSecret;
protected $userPHID;
protected $redirectURI;
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'code' => 'text32',
'clientSecret' => 'text32',
'redirectURI' => 'text255',
),
self::CONFIG_KEY_SCHEMA => array(
'code' => array(
'columns' => array('code'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
}

View file

@ -30,6 +30,21 @@ final class PhabricatorOAuthServerClient
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'secret' => 'text32',
'redirectURI' => 'text255',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'creatorPHID' => array(
'columns' => array('creatorPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -43,6 +43,25 @@ final class PhabricatorSMS
->setProviderSMSID(Filesystem::readRandomCharacters(40));
}
public function getConfiguration() {
return array(
self::CONFIG_COLUMN_SCHEMA => array(
'providerShortName' => 'text16',
'providerSMSID' => 'text40',
'toNumber' => 'text20',
'fromNumber' => 'text20?',
'body' => 'text',
'sendStatus' => 'text16?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_provider' => array(
'columns' => array('providerSMSID', 'providerShortName'),
'unique' => true,
),
),
) + parent::getConfiguration();
}
public function getTableName() {
// Slightly non-standard, but otherwise this class needs "MetaMTA" in its
// name. :/

View file

@ -0,0 +1,22 @@
<?php
final class PhabricatorStorageSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildRawSchema(
'meta_data',
'patch_status',
array(
'patch' => 'text255',
'applied' => 'uint32',
),
array(
'PRIMARY' => array(
'columns' => array('patch'),
'unique' => true,
),
));
}
}