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

Add expected schemata for Fund, Files, Flags and Legalpad

Summary: Ref T1191. Nothing too exciting in these.

Test Plan: Saw more blue in UI.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10521
This commit is contained in:
epriestley 2014-09-19 05:44:40 -07:00
parent 263dbe7bfe
commit e9ac3f436a
17 changed files with 204 additions and 0 deletions

View file

@ -683,6 +683,7 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'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 @@ phutil_register_library_map(array(
'FundInitiativeTransaction' => 'PhabricatorApplicationTransaction',
'FundInitiativeTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'FundInitiativeViewController' => 'FundController',
'FundSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'HarbormasterBuild' => array(
'HarbormasterDAO',
'PhabricatorPolicyInterface',
@ -3731,6 +3736,7 @@ phutil_register_library_map(array(
'LegalpadDocumentSignatureViewController' => 'LegalpadController',
'LegalpadMockMailReceiver' => 'PhabricatorObjectMailReceiver',
'LegalpadReplyHandler' => 'PhabricatorMailReplyHandler',
'LegalpadSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'LegalpadTransaction' => 'PhabricatorApplicationTransaction',
'LegalpadTransactionComment' => 'PhabricatorApplicationTransactionComment',
'LegalpadTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
@ -4541,6 +4547,7 @@ phutil_register_library_map(array(
'PhabricatorFileLinkView' => 'AphrontView',
'PhabricatorFileListController' => 'PhabricatorFileController',
'PhabricatorFileQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorFileSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorFileSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorFileStorageBlob' => 'PhabricatorFileDAO',
'PhabricatorFileStorageConfigurationException' => 'Exception',
@ -4573,6 +4580,7 @@ phutil_register_library_map(array(
'PhabricatorFlagEditController' => 'PhabricatorFlagController',
'PhabricatorFlagListController' => 'PhabricatorFlagController',
'PhabricatorFlagQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorFlagSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorFlagSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorFlagSelectControl' => 'AphrontFormControl',
'PhabricatorFlaggableInterface' => 'PhabricatorPHIDInterface',

View file

@ -65,6 +65,26 @@ final class PhabricatorFile extends PhabricatorFileDAO
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();
}

View file

@ -0,0 +1,20 @@
<?php
final class PhabricatorFileSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('PhabricatorFileDAO');
$this->buildEdgeSchemata(new PhabricatorFile());
$this->buildTransactionSchema(
new PhabricatorFileTransaction(),
new PhabricatorFileTransactionComment());
$this->buildTransactionSchema(
new PhabricatorMacroTransaction(),
new PhabricatorMacroTransactionComment());
}
}

View file

@ -12,4 +12,14 @@ final class PhabricatorFileTransactionComment
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;
}
}

View file

@ -6,4 +6,17 @@ final class PhabricatorTransformedFile extends PhabricatorFileDAO {
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();
}
}

View file

@ -13,6 +13,21 @@ final class PhabricatorFlag extends PhabricatorFlagDAO
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);
}

View file

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

View file

@ -28,6 +28,10 @@ final class FundBacker extends FundDAO
self::CONFIG_SERIALIZATION => array(
'properties' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'status' => 'text32',
'amountInCents' => 'uint32',
),
) + parent::getConfiguration();
}

View file

@ -48,6 +48,11 @@ final class FundInitiative extends FundDAO
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'description' => 'text',
'status' => 'text32',
),
) + parent::getConfiguration();
}

View file

@ -0,0 +1,17 @@
<?php
final class FundSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('FundDAO');
$this->buildEdgeSchemata(new FundInitiative());
$this->buildTransactionSchema(
new FundInitiativeTransaction());
$this->buildTransactionSchema(
new FundBackerTransaction());
}
}

View file

@ -54,6 +54,14 @@ final class LegalpadDocument extends LegalpadDAO
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();
}

View file

@ -16,6 +16,16 @@ final class LegalpadDocumentBody extends LegalpadDAO
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();
}

View file

@ -26,6 +26,17 @@ final class LegalpadDocumentSignature
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();
}

View file

@ -0,0 +1,15 @@
<?php
final class LegalpadSchemaSpec
extends PhabricatorConfigSchemaSpec {
public function buildSchemata() {
$this->buildLiskSchemata('LegalpadDAO');
$this->buildEdgeSchemata(new LegalpadDocument());
$this->buildTransactionSchema(
new LegalpadTransaction(),
new LegalpadTransactionComment());
}
}

View file

@ -19,4 +19,22 @@ final class LegalpadTransactionComment
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;
}
}

View file

@ -43,6 +43,19 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO
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();
}

View file

@ -1737,6 +1737,8 @@ abstract class LiskDAO {
self::SERIALIZATION_PHP => 'bytes',
);
$binary_map = $this->getBinaryColumns();
$builtin = array(
'id' => 'id',
'phid' => 'phid',
@ -1772,6 +1774,11 @@ abstract class LiskDAO {
}
}
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';