mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Generate expected schemata for Dashboards and Conpherence
Summary: Ref T1191. - Add edge schemata generation. - Hit a couple of mostly-minor issues (T6128, T6129, T6130). Test Plan: Viewed schema in web UI. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10518
This commit is contained in:
parent
1ead50c2cc
commit
8d0f0d1391
7 changed files with 107 additions and 1 deletions
|
@ -160,6 +160,7 @@ phutil_register_library_map(array(
|
|||
'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php',
|
||||
'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php',
|
||||
'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php',
|
||||
'ConpherenceSchemaSpec' => 'applications/conpherence/storage/ConpherenceSchemaSpec.php',
|
||||
'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php',
|
||||
'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php',
|
||||
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
|
||||
|
@ -1486,6 +1487,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDashboardRemarkupRule' => 'applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php',
|
||||
'PhabricatorDashboardRemovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php',
|
||||
'PhabricatorDashboardRenderingEngine' => 'applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php',
|
||||
'PhabricatorDashboardSchemaSpec' => 'applications/dashboard/storage/PhabricatorDashboardSchemaSpec.php',
|
||||
'PhabricatorDashboardSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardSearchEngine.php',
|
||||
'PhabricatorDashboardTransaction' => 'applications/dashboard/storage/PhabricatorDashboardTransaction.php',
|
||||
'PhabricatorDashboardTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php',
|
||||
|
@ -2966,6 +2968,7 @@ phutil_register_library_map(array(
|
|||
'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
|
||||
'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
|
||||
'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||
'ConpherenceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'ConpherenceSettings' => 'ConpherenceConstants',
|
||||
'ConpherenceThread' => array(
|
||||
'ConpherenceDAO',
|
||||
|
@ -4402,6 +4405,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDashboardRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'PhabricatorDashboardRemovePanelController' => 'PhabricatorDashboardController',
|
||||
'PhabricatorDashboardRenderingEngine' => 'Phobject',
|
||||
'PhabricatorDashboardSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PhabricatorDashboardSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhabricatorDashboardTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorDashboardTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||
|
|
|
@ -88,6 +88,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
|||
}
|
||||
|
||||
foreach ($keys as $key_name => $key_spec) {
|
||||
if ($key_spec === null) {
|
||||
// This is a subclass removing a key which Lisk expects.
|
||||
continue;
|
||||
}
|
||||
|
||||
$key = $this->newKey($key_name)
|
||||
->setColumnNames(idx($key_spec, 'columns', array()));
|
||||
|
||||
|
@ -97,7 +102,37 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
|||
$database->addTable($table);
|
||||
}
|
||||
|
||||
protected function buildEdgeSchemata(PhabricatorLiskDAO $object) {}
|
||||
protected function buildEdgeSchemata(PhabricatorLiskDAO $object) {
|
||||
$this->buildRawSchema(
|
||||
$object->getApplicationName(),
|
||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||
array(
|
||||
'src' => 'phid',
|
||||
'type' => 'uint32',
|
||||
'dst' => 'phid',
|
||||
'dateCreated' => 'epoch',
|
||||
'seq' => 'uint32',
|
||||
'dataID' => 'id?',
|
||||
),
|
||||
array(
|
||||
'PRIMARY' => array(
|
||||
'columns' => array('src', 'type', 'dst'),
|
||||
),
|
||||
));
|
||||
|
||||
$this->buildRawSchema(
|
||||
$object->getApplicationName(),
|
||||
PhabricatorEdgeConfig::TABLE_NAME_EDGEDATA,
|
||||
array(
|
||||
'id' => 'id',
|
||||
'data' => 'text',
|
||||
),
|
||||
array(
|
||||
'PRIMARY' => array(
|
||||
'columns' => array('id'),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
protected function getDatabase($name) {
|
||||
$server = $this->getServer();
|
||||
|
@ -202,6 +237,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
|
|||
$charset = $this->getUTF8Charset();
|
||||
$collation = $this->getUTF8Collation();
|
||||
break;
|
||||
case 'text20':
|
||||
$column_type = 'varchar(20)';
|
||||
$charset = $this->getUTF8Charset();
|
||||
$collation = $this->getUTF8Collation();
|
||||
break;
|
||||
case 'text16':
|
||||
$column_type = 'varchar(16)';
|
||||
$charset = $this->getUTF8Charset();
|
||||
|
|
|
@ -15,6 +15,16 @@ final class ConpherenceParticipant extends ConpherenceDAO {
|
|||
self::CONFIG_SERIALIZATION => array(
|
||||
'settings' => self::SERIALIZATION_JSON,
|
||||
),
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'participationStatus' => 'uint32',
|
||||
'dateTouched' => 'epoch',
|
||||
'seenMessageCount' => 'uint64',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
'conpherencePHID' => array(
|
||||
'columns' => array('conpherencePHID', 'participantPHID'),
|
||||
),
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class ConpherenceSchemaSpec
|
||||
extends PhabricatorConfigSchemaSpec {
|
||||
|
||||
public function buildSchemata() {
|
||||
$this->buildLiskSchemata('ConpherenceDAO');
|
||||
|
||||
$this->buildEdgeSchemata(new ConpherenceThread());
|
||||
|
||||
$this->buildTransactionSchema(
|
||||
new ConpherenceTransaction(),
|
||||
new ConpherenceTransactionComment());
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,17 @@ final class ConpherenceThread extends ConpherenceDAO
|
|||
self::CONFIG_SERIALIZATION => array(
|
||||
'recentParticipantPHIDs' => self::SERIALIZATION_JSON,
|
||||
),
|
||||
self::CONFIG_COLUMN_SCHEMA => array(
|
||||
'title' => 'text255?',
|
||||
'messageCount' => 'uint64',
|
||||
'mailKey' => 'text20',
|
||||
),
|
||||
self::CONFIG_KEY_SCHEMA => array(
|
||||
'key_phid' => null,
|
||||
'phid' => array(
|
||||
'columns' => array('phid'),
|
||||
),
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,4 +9,12 @@ final class ConpherenceTransactionComment
|
|||
return new ConpherenceTransaction();
|
||||
}
|
||||
|
||||
public function getConfiguration() {
|
||||
$config = parent::getConfiguration();
|
||||
$config[self::CONFIG_COLUMN_SCHEMA] = array(
|
||||
'conpherencePHID' => 'phid?',
|
||||
) + $config[self::CONFIG_COLUMN_SCHEMA];
|
||||
return $config;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDashboardSchemaSpec
|
||||
extends PhabricatorConfigSchemaSpec {
|
||||
|
||||
public function buildSchemata() {
|
||||
$this->buildLiskSchemata('PhabricatorDashboardDAO');
|
||||
|
||||
$this->buildEdgeSchemata(new PhabricatorDashboard());
|
||||
|
||||
$this->buildTransactionSchema(
|
||||
new PhabricatorDashboardTransaction());
|
||||
$this->buildTransactionSchema(
|
||||
new PhabricatorDashboardPanelTransaction());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue