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 @@ -683,6 +683,7 @@ 'FundInitiativeTransaction' => 'applications/fund/storage/FundInitiativeTransaction.php', 'FundInitiativeTransactionQuery' => 'applications/fund/query/FundInitiativeTransactionQuery.php', 'FundInitiativeViewController' => 'applications/fund/controller/FundInitiativeViewController.php', + 'FundSchemaSpec' => 'applications/fund/storage/FundSchemaSpec.php', 'HarbormasterBuild' => 'applications/harbormaster/storage/build/HarbormasterBuild.php', 'HarbormasterBuildAbortedException' => 'applications/harbormaster/exception/HarbormasterBuildAbortedException.php', 'HarbormasterBuildActionController' => 'applications/harbormaster/controller/HarbormasterBuildActionController.php', @@ -860,6 +861,7 @@ 'LegalpadDocumentSignatureViewController' => 'applications/legalpad/controller/LegalpadDocumentSignatureViewController.php', 'LegalpadMockMailReceiver' => 'applications/legalpad/mail/LegalpadMockMailReceiver.php', 'LegalpadReplyHandler' => 'applications/legalpad/mail/LegalpadReplyHandler.php', + 'LegalpadSchemaSpec' => 'applications/legalpad/storage/LegalpadSchemaSpec.php', 'LegalpadTransaction' => 'applications/legalpad/storage/LegalpadTransaction.php', 'LegalpadTransactionComment' => 'applications/legalpad/storage/LegalpadTransactionComment.php', 'LegalpadTransactionQuery' => 'applications/legalpad/query/LegalpadTransactionQuery.php', @@ -1611,6 +1613,7 @@ 'PhabricatorFileLinkView' => 'view/layout/PhabricatorFileLinkView.php', 'PhabricatorFileListController' => 'applications/files/controller/PhabricatorFileListController.php', 'PhabricatorFileQuery' => 'applications/files/query/PhabricatorFileQuery.php', + 'PhabricatorFileSchemaSpec' => 'applications/files/storage/PhabricatorFileSchemaSpec.php', 'PhabricatorFileSearchEngine' => 'applications/files/query/PhabricatorFileSearchEngine.php', 'PhabricatorFileStorageBlob' => 'applications/files/storage/PhabricatorFileStorageBlob.php', 'PhabricatorFileStorageConfigurationException' => 'applications/files/exception/PhabricatorFileStorageConfigurationException.php', @@ -1643,6 +1646,7 @@ 'PhabricatorFlagEditController' => 'applications/flag/controller/PhabricatorFlagEditController.php', 'PhabricatorFlagListController' => 'applications/flag/controller/PhabricatorFlagListController.php', 'PhabricatorFlagQuery' => 'applications/flag/query/PhabricatorFlagQuery.php', + 'PhabricatorFlagSchemaSpec' => 'applications/flag/storage/PhabricatorFlagSchemaSpec.php', 'PhabricatorFlagSearchEngine' => 'applications/flag/query/PhabricatorFlagSearchEngine.php', 'PhabricatorFlagSelectControl' => 'applications/flag/view/PhabricatorFlagSelectControl.php', 'PhabricatorFlaggableInterface' => 'applications/flag/interface/PhabricatorFlaggableInterface.php', @@ -3516,6 +3520,7 @@ 'FundInitiativeTransaction' => 'PhabricatorApplicationTransaction', 'FundInitiativeTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'FundInitiativeViewController' => 'FundController', + 'FundSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'HarbormasterBuild' => array( 'HarbormasterDAO', 'PhabricatorPolicyInterface', @@ -3731,6 +3736,7 @@ 'LegalpadDocumentSignatureViewController' => 'LegalpadController', 'LegalpadMockMailReceiver' => 'PhabricatorObjectMailReceiver', 'LegalpadReplyHandler' => 'PhabricatorMailReplyHandler', + 'LegalpadSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'LegalpadTransaction' => 'PhabricatorApplicationTransaction', 'LegalpadTransactionComment' => 'PhabricatorApplicationTransactionComment', 'LegalpadTransactionQuery' => 'PhabricatorApplicationTransactionQuery', @@ -4541,6 +4547,7 @@ 'PhabricatorFileLinkView' => 'AphrontView', 'PhabricatorFileListController' => 'PhabricatorFileController', 'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorFileSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorFileSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorFileStorageBlob' => 'PhabricatorFileDAO', 'PhabricatorFileStorageConfigurationException' => 'Exception', @@ -4573,6 +4580,7 @@ 'PhabricatorFlagEditController' => 'PhabricatorFlagController', 'PhabricatorFlagListController' => 'PhabricatorFlagController', 'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorFlagSchemaSpec' => 'PhabricatorConfigSchemaSpec', 'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorFlagSelectControl' => 'AphrontFormControl', 'PhabricatorFlaggableInterface' => 'PhabricatorPHIDInterface', diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -65,6 +65,26 @@ self::CONFIG_SERIALIZATION => array( 'metadata' => self::SERIALIZATION_JSON, ), + self::CONFIG_COLUMN_SCHEMA => array( + 'name' => 'text255?', + 'mimeType' => 'text255?', + 'byteSize' => 'uint64?', + 'storageEngine' => 'text32', + 'storageFormat' => 'text32', + 'storageHandle' => 'text255', + 'authorPHID' => 'phid?', + 'secretKey' => 'bytes20?', + 'contentHash' => 'bytes40?', + 'ttl' => 'epoch?', + 'isExplicitUpload' => 'bool?', + 'mailKey' => 'bytes20', + ), + self::CONFIG_KEY_SCHEMA => array( + 'key_phid' => null, + 'phid' => array( + 'columns' => array('phid'), + ), + ), ) + parent::getConfiguration(); } diff --git a/src/applications/files/storage/PhabricatorFileSchemaSpec.php b/src/applications/files/storage/PhabricatorFileSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/files/storage/PhabricatorFileSchemaSpec.php @@ -0,0 +1,20 @@ +buildLiskSchemata('PhabricatorFileDAO'); + + $this->buildEdgeSchemata(new PhabricatorFile()); + + $this->buildTransactionSchema( + new PhabricatorFileTransaction(), + new PhabricatorFileTransactionComment()); + + $this->buildTransactionSchema( + new PhabricatorMacroTransaction(), + new PhabricatorMacroTransactionComment()); + } + +} diff --git a/src/applications/files/storage/PhabricatorFileTransactionComment.php b/src/applications/files/storage/PhabricatorFileTransactionComment.php --- a/src/applications/files/storage/PhabricatorFileTransactionComment.php +++ b/src/applications/files/storage/PhabricatorFileTransactionComment.php @@ -12,4 +12,14 @@ return ($this->getTransactionPHID() != null); } + public function getConfiguration() { + $config = parent::getConfiguration(); + $config[self::CONFIG_KEY_SCHEMA] = array( + 'key_draft' => array( + 'columns' => array('authorPHID', 'transactionPHID'), + ), + ) + $config[self::CONFIG_KEY_SCHEMA]; + return $config; + } + } diff --git a/src/applications/files/storage/PhabricatorTransformedFile.php b/src/applications/files/storage/PhabricatorTransformedFile.php --- a/src/applications/files/storage/PhabricatorTransformedFile.php +++ b/src/applications/files/storage/PhabricatorTransformedFile.php @@ -6,4 +6,17 @@ protected $transform; protected $transformedPHID; + public function getConfiguration() { + return array( + self::CONFIG_COLUMN_SCHEMA => array( + 'transform' => 'text255', + ), + self::CONFIG_KEY_SCHEMA => array( + 'originalPHID' => array( + 'columns' => array('originalPHID', 'transform'), + ), + ), + ) + parent::getConfiguration(); + } + } diff --git a/src/applications/flag/storage/PhabricatorFlag.php b/src/applications/flag/storage/PhabricatorFlag.php --- a/src/applications/flag/storage/PhabricatorFlag.php +++ b/src/applications/flag/storage/PhabricatorFlag.php @@ -13,6 +13,21 @@ private $handle = self::ATTACHABLE; private $object = self::ATTACHABLE; + public function getConfiguration() { + return array( + self::CONFIG_COLUMN_SCHEMA => array( + 'type' => 'text4', + 'color' => 'uint32', + 'note' => 'text', + ), + self::CONFIG_KEY_SCHEMA => array( + 'ownerPHID' => array( + 'columns' => array('ownerPHID', 'type', 'objectPHID'), + ), + ), + ) + parent::getConfiguration(); + } + public function getObject() { return $this->assertAttached($this->object); } diff --git a/src/applications/flag/storage/PhabricatorFlagSchemaSpec.php b/src/applications/flag/storage/PhabricatorFlagSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/flag/storage/PhabricatorFlagSchemaSpec.php @@ -0,0 +1,10 @@ +buildLiskSchemata('PhabricatorFlagDAO'); + } + +} diff --git a/src/applications/fund/storage/FundBacker.php b/src/applications/fund/storage/FundBacker.php --- a/src/applications/fund/storage/FundBacker.php +++ b/src/applications/fund/storage/FundBacker.php @@ -28,6 +28,10 @@ self::CONFIG_SERIALIZATION => array( 'properties' => self::SERIALIZATION_JSON, ), + self::CONFIG_COLUMN_SCHEMA => array( + 'status' => 'text32', + 'amountInCents' => 'uint32', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -48,6 +48,11 @@ public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_COLUMN_SCHEMA => array( + 'name' => 'text255', + 'description' => 'text', + 'status' => 'text32', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/fund/storage/FundSchemaSpec.php b/src/applications/fund/storage/FundSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/fund/storage/FundSchemaSpec.php @@ -0,0 +1,17 @@ +buildLiskSchemata('FundDAO'); + $this->buildEdgeSchemata(new FundInitiative()); + + $this->buildTransactionSchema( + new FundInitiativeTransaction()); + + $this->buildTransactionSchema( + new FundBackerTransaction()); + } + +} diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -54,6 +54,14 @@ self::CONFIG_SERIALIZATION => array( 'recentContributorPHIDs' => self::SERIALIZATION_JSON, ), + self::CONFIG_COLUMN_SCHEMA => array( + 'title' => 'text255', + 'contributorCount' => 'uint32', + 'versions' => 'uint32', + 'mailKey' => 'bytes20', + 'signatureType' => 'text4', + 'preamble' => 'text', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/legalpad/storage/LegalpadDocumentBody.php b/src/applications/legalpad/storage/LegalpadDocumentBody.php --- a/src/applications/legalpad/storage/LegalpadDocumentBody.php +++ b/src/applications/legalpad/storage/LegalpadDocumentBody.php @@ -16,6 +16,16 @@ public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_COLUMN_SCHEMA => array( + 'version' => 'uint32', + 'title' => 'text255', + 'text' => 'text?', + ), + self::CONFIG_KEY_SCHEMA => array( + 'key_document' => array( + 'columns' => array('documentPHID', 'version'), + ), + ), ) + parent::getConfiguration(); } diff --git a/src/applications/legalpad/storage/LegalpadDocumentSignature.php b/src/applications/legalpad/storage/LegalpadDocumentSignature.php --- a/src/applications/legalpad/storage/LegalpadDocumentSignature.php +++ b/src/applications/legalpad/storage/LegalpadDocumentSignature.php @@ -26,6 +26,17 @@ self::CONFIG_SERIALIZATION => array( 'signatureData' => self::SERIALIZATION_JSON, ), + self::CONFIG_COLUMN_SCHEMA => array( + 'documentVersion' => 'uint32', + 'signatureType' => 'text4', + 'signerPHID' => 'phid?', + 'signerName' => 'text255', + 'signerEmail' => 'text255', + 'secretKey' => 'bytes20', + 'verified' => 'bool?', + 'isExemption' => 'bool', + 'exemptionPHID' => 'phid?', + ), ) + parent::getConfiguration(); } diff --git a/src/applications/legalpad/storage/LegalpadSchemaSpec.php b/src/applications/legalpad/storage/LegalpadSchemaSpec.php new file mode 100644 --- /dev/null +++ b/src/applications/legalpad/storage/LegalpadSchemaSpec.php @@ -0,0 +1,15 @@ +buildLiskSchemata('LegalpadDAO'); + $this->buildEdgeSchemata(new LegalpadDocument()); + + $this->buildTransactionSchema( + new LegalpadTransaction(), + new LegalpadTransactionComment()); + } + +} diff --git a/src/applications/legalpad/storage/LegalpadTransactionComment.php b/src/applications/legalpad/storage/LegalpadTransactionComment.php --- a/src/applications/legalpad/storage/LegalpadTransactionComment.php +++ b/src/applications/legalpad/storage/LegalpadTransactionComment.php @@ -19,4 +19,22 @@ return ($this->getTransactionPHID() != null); } + public function getConfiguration() { + $config = parent::getConfiguration(); + $config[self::CONFIG_COLUMN_SCHEMA] = array( + 'documentID' => 'id?', + 'lineNumber' => 'uint32', + 'lineLength' => 'uint32', + 'fixedState' => 'text12?', + 'hasReplies' => 'bool', + 'replyToCommentPHID' => 'phid?', + ) + $config[self::CONFIG_COLUMN_SCHEMA]; + $config[self::CONFIG_KEY_SCHEMA] = array( + 'key_draft' => array( + 'columns' => array('authorPHID', 'documentID', 'transactionPHID'), + ), + ) + $config[self::CONFIG_KEY_SCHEMA]; + return $config; + } + } diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -43,6 +43,19 @@ public function getConfiguration() { return array( self::CONFIG_AUX_PHID => true, + self::CONFIG_COLUMN_SCHEMA => array( + 'name' => 'text255', + 'authorPHID' => 'phid?', + 'isDisabled' => 'bool', + 'audioPHID' => 'phid?', + 'audioBehavior' => 'text64', + 'mailKey' => 'bytes20', + ), + self::CONFIG_KEY_SCHEMA => array( + 'name' => array( + 'columns' => array('name'), + ), + ), ) + parent::getConfiguration(); } diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php --- a/src/infrastructure/storage/lisk/LiskDAO.php +++ b/src/infrastructure/storage/lisk/LiskDAO.php @@ -1737,6 +1737,8 @@ self::SERIALIZATION_PHP => 'bytes', ); + $binary_map = $this->getBinaryColumns(); + $builtin = array( 'id' => 'id', 'phid' => 'phid', @@ -1772,6 +1774,11 @@ } } + if (isset($binary_map[$property])) { + $map[$property] = 'bytes'; + continue; + } + // If the column is named `somethingPHID`, infer it is a PHID. if (preg_match('/[a-z]PHID$/', $property)) { $map[$property] = 'phid';