1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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:
epriestley 2014-09-18 11:15:38 -07:00
parent 1ead50c2cc
commit 8d0f0d1391
7 changed files with 107 additions and 1 deletions

View file

@ -160,6 +160,7 @@ phutil_register_library_map(array(
'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php', 'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php',
'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php', 'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php',
'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php', 'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php',
'ConpherenceSchemaSpec' => 'applications/conpherence/storage/ConpherenceSchemaSpec.php',
'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php', 'ConpherenceSettings' => 'applications/conpherence/constants/ConpherenceSettings.php',
'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php', 'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php',
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php', 'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
@ -1486,6 +1487,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardRemarkupRule' => 'applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php', 'PhabricatorDashboardRemarkupRule' => 'applications/dashboard/remarkup/PhabricatorDashboardRemarkupRule.php',
'PhabricatorDashboardRemovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php', 'PhabricatorDashboardRemovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php',
'PhabricatorDashboardRenderingEngine' => 'applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php', 'PhabricatorDashboardRenderingEngine' => 'applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php',
'PhabricatorDashboardSchemaSpec' => 'applications/dashboard/storage/PhabricatorDashboardSchemaSpec.php',
'PhabricatorDashboardSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardSearchEngine.php', 'PhabricatorDashboardSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardSearchEngine.php',
'PhabricatorDashboardTransaction' => 'applications/dashboard/storage/PhabricatorDashboardTransaction.php', 'PhabricatorDashboardTransaction' => 'applications/dashboard/storage/PhabricatorDashboardTransaction.php',
'PhabricatorDashboardTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php', 'PhabricatorDashboardTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardTransactionEditor.php',
@ -2966,6 +2968,7 @@ phutil_register_library_map(array(
'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler',
'ConpherenceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'ConpherenceSettings' => 'ConpherenceConstants', 'ConpherenceSettings' => 'ConpherenceConstants',
'ConpherenceThread' => array( 'ConpherenceThread' => array(
'ConpherenceDAO', 'ConpherenceDAO',
@ -4402,6 +4405,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardRemarkupRule' => 'PhabricatorObjectRemarkupRule', 'PhabricatorDashboardRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'PhabricatorDashboardRemovePanelController' => 'PhabricatorDashboardController', 'PhabricatorDashboardRemovePanelController' => 'PhabricatorDashboardController',
'PhabricatorDashboardRenderingEngine' => 'Phobject', 'PhabricatorDashboardRenderingEngine' => 'Phobject',
'PhabricatorDashboardSchemaSpec' => 'PhabricatorConfigSchemaSpec',
'PhabricatorDashboardSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorDashboardSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorDashboardTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorDashboardTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorDashboardTransactionEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorDashboardTransactionEditor' => 'PhabricatorApplicationTransactionEditor',

View file

@ -88,6 +88,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
} }
foreach ($keys as $key_name => $key_spec) { 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) $key = $this->newKey($key_name)
->setColumnNames(idx($key_spec, 'columns', array())); ->setColumnNames(idx($key_spec, 'columns', array()));
@ -97,7 +102,37 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$database->addTable($table); $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) { protected function getDatabase($name) {
$server = $this->getServer(); $server = $this->getServer();
@ -202,6 +237,11 @@ abstract class PhabricatorConfigSchemaSpec extends Phobject {
$charset = $this->getUTF8Charset(); $charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation(); $collation = $this->getUTF8Collation();
break; break;
case 'text20':
$column_type = 'varchar(20)';
$charset = $this->getUTF8Charset();
$collation = $this->getUTF8Collation();
break;
case 'text16': case 'text16':
$column_type = 'varchar(16)'; $column_type = 'varchar(16)';
$charset = $this->getUTF8Charset(); $charset = $this->getUTF8Charset();

View file

@ -15,6 +15,16 @@ final class ConpherenceParticipant extends ConpherenceDAO {
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'settings' => self::SERIALIZATION_JSON, '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(); ) + parent::getConfiguration();
} }

View file

@ -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());
}
}

View file

@ -27,6 +27,17 @@ final class ConpherenceThread extends ConpherenceDAO
self::CONFIG_SERIALIZATION => array( self::CONFIG_SERIALIZATION => array(
'recentParticipantPHIDs' => self::SERIALIZATION_JSON, '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(); ) + parent::getConfiguration();
} }

View file

@ -9,4 +9,12 @@ final class ConpherenceTransactionComment
return new ConpherenceTransaction(); return new ConpherenceTransaction();
} }
public function getConfiguration() {
$config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array(
'conpherencePHID' => 'phid?',
) + $config[self::CONFIG_COLUMN_SCHEMA];
return $config;
}
} }

View file

@ -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());
}
}