diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -991,6 +991,7 @@ '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', @@ -1806,6 +1807,7 @@ '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', @@ -1842,6 +1844,7 @@ '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', @@ -2303,6 +2306,7 @@ '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', @@ -3890,6 +3894,7 @@ 'NuanceRequestorTransactionComment' => 'PhabricatorApplicationTransactionComment', 'NuanceRequestorTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'NuanceRequestorViewController' => 'NuanceController', + 'NuanceSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'NuanceSource' => array( 'NuanceDAO', 'PhabricatorPolicyInterface', @@ -4735,6 +4740,7 @@ 'PhabricatorMetaMTAReceivedMail' => 'PhabricatorMetaMTADAO', 'PhabricatorMetaMTAReceivedMailProcessingException' => 'Exception', 'PhabricatorMetaMTAReceivedMailTestCase' => 'PhabricatorTestCase', + 'PhabricatorMetaMTASchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController', 'PhabricatorMetaMTAWorker' => 'PhabricatorWorker', 'PhabricatorMultiColumnExample' => 'PhabricatorUIExample', @@ -4775,6 +4781,7 @@ 'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientController', 'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientController', 'PhabricatorOAuthResponse' => 'AphrontResponse', + 'PhabricatorOAuthSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO', 'PhabricatorOAuthServerApplication' => 'PhabricatorApplication', 'PhabricatorOAuthServerAuthController' => 'PhabricatorAuthController', @@ -5280,6 +5287,7 @@ 'PhabricatorStorageManagementStatusWorkflow' => 'PhabricatorStorageManagementWorkflow', 'PhabricatorStorageManagementUpgradeWorkflow' => 'PhabricatorStorageManagementWorkflow', 'PhabricatorStorageManagementWorkflow' => 'PhabricatorManagementWorkflow', + 'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorSubscribersQuery' => 'PhabricatorQuery', 'PhabricatorSubscriptionsApplication' => 'PhabricatorApplication', 'PhabricatorSubscriptionsEditController' => 'PhabricatorController', diff --git a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php --- a/src/applications/config/schema/PhabricatorConfigSchemaSpec.php +++ b/src/applications/config/schema/PhabricatorConfigSchemaSpec.php @@ -271,6 +271,11 @@ $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(); diff --git a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php --- a/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php +++ b/src/applications/mailinglists/storage/PhabricatorMetaMTAMailingList.php @@ -17,6 +17,26 @@ 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(); } diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -32,6 +32,22 @@ 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(); } diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php --- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php @@ -19,6 +19,27 @@ '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(); } diff --git a/src/applications/metamta/storage/PhabricatorMetaMTASchemaSpec.php b/src/applications/metamta/storage/PhabricatorMetaMTASchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/metamta/storage/PhabricatorMetaMTASchemaSpec.php @@ -0,0 +1,14 @@ +buildLiskSchemata('PhabricatorMetaMTADAO'); + $this->buildLiskSchemata('PhabricatorSMSDAO'); + + $this->buildEdgeSchemata( + new PhabricatorMetaMTAMail()); + } + +} diff --git a/src/applications/nuance/storage/NuanceItem.php b/src/applications/nuance/storage/NuanceItem.php --- a/src/applications/nuance/storage/NuanceItem.php +++ b/src/applications/nuance/storage/NuanceItem.php @@ -22,12 +22,31 @@ ->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(); } diff --git a/src/applications/nuance/storage/NuanceQueue.php b/src/applications/nuance/storage/NuanceQueue.php --- a/src/applications/nuance/storage/NuanceQueue.php +++ b/src/applications/nuance/storage/NuanceQueue.php @@ -12,6 +12,10 @@ public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_COLUMN_SCHEMA => array( + 'name' => 'text255?', + 'mailKey' => 'bytes20', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/nuance/storage/NuanceQueueItem.php b/src/applications/nuance/storage/NuanceQueueItem.php --- a/src/applications/nuance/storage/NuanceQueueItem.php +++ b/src/applications/nuance/storage/NuanceQueueItem.php @@ -8,5 +8,22 @@ 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(); + } } diff --git a/src/applications/nuance/storage/NuanceSchemaSpec.php b/src/applications/nuance/storage/NuanceSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/nuance/storage/NuanceSchemaSpec.php @@ -0,0 +1,27 @@ +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()); + } + +} diff --git a/src/applications/nuance/storage/NuanceSource.php b/src/applications/nuance/storage/NuanceSource.php --- a/src/applications/nuance/storage/NuanceSource.php +++ b/src/applications/nuance/storage/NuanceSource.php @@ -16,6 +16,16 @@ 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(); } diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php b/src/applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php --- a/src/applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php +++ b/src/applications/oauthserver/storage/PhabricatorOAuthClientAuthorization.php @@ -23,6 +23,20 @@ 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(); } diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthSchemaSpec.php b/src/applications/oauthserver/storage/PhabricatorOAuthSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/oauthserver/storage/PhabricatorOAuthSchemaSpec.php @@ -0,0 +1,10 @@ +buildLiskSchemata('PhabricatorOAuthServerDAO'); + } + +} diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthServerAccessToken.php b/src/applications/oauthserver/storage/PhabricatorOAuthServerAccessToken.php --- a/src/applications/oauthserver/storage/PhabricatorOAuthServerAccessToken.php +++ b/src/applications/oauthserver/storage/PhabricatorOAuthServerAccessToken.php @@ -7,4 +7,19 @@ 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(); + } + } diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthServerAuthorizationCode.php b/src/applications/oauthserver/storage/PhabricatorOAuthServerAuthorizationCode.php --- a/src/applications/oauthserver/storage/PhabricatorOAuthServerAuthorizationCode.php +++ b/src/applications/oauthserver/storage/PhabricatorOAuthServerAuthorizationCode.php @@ -9,4 +9,21 @@ 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(); + } + } diff --git a/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php b/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php --- a/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php +++ b/src/applications/oauthserver/storage/PhabricatorOAuthServerClient.php @@ -30,6 +30,21 @@ 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(); } diff --git a/src/infrastructure/sms/storage/PhabricatorSMS.php b/src/infrastructure/sms/storage/PhabricatorSMS.php --- a/src/infrastructure/sms/storage/PhabricatorSMS.php +++ b/src/infrastructure/sms/storage/PhabricatorSMS.php @@ -43,6 +43,25 @@ ->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. :/ diff --git a/src/infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php b/src/infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php @@ -0,0 +1,22 @@ +buildRawSchema( + 'meta_data', + 'patch_status', + array( + 'patch' => 'text255', + 'applied' => 'uint32', + ), + array( + 'PRIMARY' => array( + 'columns' => array('patch'), + 'unique' => true, + ), + )); + } + +}