Skip to content

Commit 67fbfe6

Browse files
author
epriestley
committedSep 18, 2014
Generate expected schemata for Doorkeeper, Draft, Drydock, Feed
Summary: Ref T1191. Notable: - Allowed objects to remove default columns (some feed tables have no `id`). - Added a "note" severity and moved all the charset stuff down to that to make progress more clear. Test Plan: Trying to make the whole thing blue... {F205970} Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10519
1 parent 8d0f0d1 commit 67fbfe6

22 files changed

+203
-9
lines changed
 

‎src/__phutil_library_map__.php

+8
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@
570570
'DoorkeeperRemarkupRule' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRule.php',
571571
'DoorkeeperRemarkupRuleAsana' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleAsana.php',
572572
'DoorkeeperRemarkupRuleJIRA' => 'applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php',
573+
'DoorkeeperSchemaSpec' => 'applications/doorkeeper/storage/DoorkeeperSchemaSpec.php',
573574
'DoorkeeperTagView' => 'applications/doorkeeper/view/DoorkeeperTagView.php',
574575
'DoorkeeperTagsController' => 'applications/doorkeeper/controller/DoorkeeperTagsController.php',
575576
'DrydockAllocatorWorker' => 'applications/drydock/worker/DrydockAllocatorWorker.php',
@@ -636,6 +637,7 @@
636637
'DrydockResourceViewController' => 'applications/drydock/controller/DrydockResourceViewController.php',
637638
'DrydockSFTPFilesystemInterface' => 'applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php',
638639
'DrydockSSHCommandInterface' => 'applications/drydock/interface/command/DrydockSSHCommandInterface.php',
640+
'DrydockSchemaSpec' => 'applications/drydock/storage/DrydockSchemaSpec.php',
639641
'DrydockWebrootInterface' => 'applications/drydock/interface/webroot/DrydockWebrootInterface.php',
640642
'DrydockWorkingCopyBlueprintImplementation' => 'applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php',
641643
'FeedConduitAPIMethod' => 'applications/feed/conduit/FeedConduitAPIMethod.php',
@@ -1514,6 +1516,7 @@
15141516
'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php',
15151517
'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php',
15161518
'PhabricatorDraftDAO' => 'applications/draft/storage/PhabricatorDraftDAO.php',
1519+
'PhabricatorDraftSchemaSpec' => 'applications/draft/storage/PhabricatorDraftSchemaSpec.php',
15171520
'PhabricatorDrydockApplication' => 'applications/drydock/application/PhabricatorDrydockApplication.php',
15181521
'PhabricatorEdgeConfig' => 'infrastructure/edges/constants/PhabricatorEdgeConfig.php',
15191522
'PhabricatorEdgeConstants' => 'infrastructure/edges/constants/PhabricatorEdgeConstants.php',
@@ -1574,6 +1577,7 @@
15741577
'PhabricatorFeedManagementWorkflow' => 'applications/feed/management/PhabricatorFeedManagementWorkflow.php',
15751578
'PhabricatorFeedPublicStreamController' => 'applications/feed/controller/PhabricatorFeedPublicStreamController.php',
15761579
'PhabricatorFeedQuery' => 'applications/feed/query/PhabricatorFeedQuery.php',
1580+
'PhabricatorFeedSchemaSpec' => 'applications/feed/storage/PhabricatorFeedSchemaSpec.php',
15771581
'PhabricatorFeedSearchEngine' => 'applications/feed/query/PhabricatorFeedSearchEngine.php',
15781582
'PhabricatorFeedStory' => 'applications/feed/story/PhabricatorFeedStory.php',
15791583
'PhabricatorFeedStoryAggregate' => 'applications/feed/story/PhabricatorFeedStoryAggregate.php',
@@ -3373,6 +3377,7 @@
33733377
'DoorkeeperRemarkupRule' => 'PhutilRemarkupRule',
33743378
'DoorkeeperRemarkupRuleAsana' => 'DoorkeeperRemarkupRule',
33753379
'DoorkeeperRemarkupRuleJIRA' => 'DoorkeeperRemarkupRule',
3380+
'DoorkeeperSchemaSpec' => 'PhabricatorConfigSchemaSpec',
33763381
'DoorkeeperTagView' => 'AphrontView',
33773382
'DoorkeeperTagsController' => 'PhabricatorController',
33783383
'DrydockAllocatorWorker' => 'PhabricatorWorker',
@@ -3451,6 +3456,7 @@
34513456
'DrydockResourceViewController' => 'DrydockResourceController',
34523457
'DrydockSFTPFilesystemInterface' => 'DrydockFilesystemInterface',
34533458
'DrydockSSHCommandInterface' => 'DrydockCommandInterface',
3459+
'DrydockSchemaSpec' => 'PhabricatorConfigSchemaSpec',
34543460
'DrydockWebrootInterface' => 'DrydockInterface',
34553461
'DrydockWorkingCopyBlueprintImplementation' => 'DrydockBlueprintImplementation',
34563462
'FeedConduitAPIMethod' => 'ConduitAPIMethod',
@@ -4430,6 +4436,7 @@
44304436
'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication',
44314437
'PhabricatorDraft' => 'PhabricatorDraftDAO',
44324438
'PhabricatorDraftDAO' => 'PhabricatorLiskDAO',
4439+
'PhabricatorDraftSchemaSpec' => 'PhabricatorConfigSchemaSpec',
44334440
'PhabricatorDrydockApplication' => 'PhabricatorApplication',
44344441
'PhabricatorEdgeConfig' => 'PhabricatorEdgeConstants',
44354442
'PhabricatorEdgeCycleException' => 'Exception',
@@ -4486,6 +4493,7 @@
44864493
'PhabricatorFeedManagementWorkflow' => 'PhabricatorManagementWorkflow',
44874494
'PhabricatorFeedPublicStreamController' => 'PhabricatorFeedController',
44884495
'PhabricatorFeedQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
4496+
'PhabricatorFeedSchemaSpec' => 'PhabricatorConfigSchemaSpec',
44894497
'PhabricatorFeedSearchEngine' => 'PhabricatorApplicationSearchEngine',
44904498
'PhabricatorFeedStory' => array(
44914499
'PhabricatorPolicyInterface',

‎src/applications/auth/storage/PhabricatorAuthProviderConfig.php

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public function getConfiguration() {
3131
),
3232
self::CONFIG_COLUMN_SCHEMA => array(
3333
'isEnabled' => 'bool',
34+
'providerClass' => 'text128',
35+
'providerType' => 'text64',
36+
'providerDomain' => 'text128',
3437
'shouldAllowLogin' => 'bool',
3538
'shouldAllowRegistration' => 'bool',
3639
'shouldAllowLink' => 'bool',

‎src/applications/config/controller/PhabricatorConfigDatabaseController.php

+7
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ private function renderIcon($status) {
688688
case PhabricatorConfigStorageSchema::STATUS_OKAY:
689689
$icon = 'fa-check-circle green';
690690
break;
691+
case PhabricatorConfigStorageSchema::STATUS_NOTE:
692+
$icon = 'fa-info-circle blue';
693+
break;
691694
case PhabricatorConfigStorageSchema::STATUS_WARN:
692695
$icon = 'fa-exclamation-circle yellow';
693696
break;
@@ -735,6 +738,10 @@ private function buildProperties(array $properties, array $issues) {
735738

736739
$status = PhabricatorConfigStorageSchema::getIssueStatus($issue);
737740
switch ($status) {
741+
case PhabricatorConfigStorageSchema::STATUS_NOTE:
742+
$icon = PHUIStatusItemView::ICON_INFO;
743+
$color = 'blue';
744+
break;
738745
case PhabricatorConfigStorageSchema::STATUS_WARN:
739746
$icon = PHUIStatusItemView::ICON_WARNING;
740747
$color = 'yellow';

‎src/applications/config/schema/PhabricatorConfigSchemaSpec.php

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ protected function buildRawSchema(
7474
$table = $this->newTable($table_name);
7575

7676
foreach ($columns as $name => $type) {
77+
if ($type === null) {
78+
continue;
79+
}
80+
7781
$details = $this->getDetailsForDataType($type);
7882
list($column_type, $charset, $collation, $nullable) = $details;
7983

‎src/applications/config/schema/PhabricatorConfigStorageSchema.php

+16-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ abstract class PhabricatorConfigStorageSchema extends Phobject {
99
const ISSUE_COLUMNTYPE = 'columntype';
1010
const ISSUE_NULLABLE = 'nullable';
1111
const ISSUE_KEYCOLUMNS = 'keycolumns';
12+
const ISSUE_SUBNOTE = 'subnote';
1213
const ISSUE_SUBWARN = 'subwarn';
1314
const ISSUE_SUBFAIL = 'subfail';
1415

1516
const STATUS_OKAY = 'okay';
17+
const STATUS_NOTE = 'note';
1618
const STATUS_WARN = 'warn';
1719
const STATUS_FAIL = 'fail';
1820

@@ -55,6 +57,9 @@ public function getIssues() {
5557

5658
foreach ($this->getSubschemata() as $sub) {
5759
switch ($sub->getStatus()) {
60+
case self::STATUS_NOTE:
61+
$issues[self::ISSUE_SUBNOTE] = self::ISSUE_SUBNOTE;
62+
break;
5863
case self::STATUS_WARN:
5964
$issues[self::ISSUE_SUBWARN] = self::ISSUE_SUBWARN;
6065
break;
@@ -104,6 +109,8 @@ public static function getIssueName($issue) {
104109
return pht('Wrong Nullable Setting');
105110
case self::ISSUE_KEYCOLUMNS:
106111
return pht('Key on Wrong Columns');
112+
case self::ISSUE_SUBNOTE:
113+
return pht('Subschemata Have Notices');
107114
case self::ISSUE_SUBWARN:
108115
return pht('Subschemata Have Warnings');
109116
case self::ISSUE_SUBFAIL:
@@ -129,6 +136,8 @@ public static function getIssueDescription($issue) {
129136
return pht('This schema has the wrong nullable setting.');
130137
case self::ISSUE_KEYCOLUMNS:
131138
return pht('This schema is on the wrong columns.');
139+
case self::ISSUE_SUBNOTE:
140+
return pht('Subschemata have setup notices.');
132141
case self::ISSUE_SUBWARN:
133142
return pht('Subschemata have setup warnings.');
134143
case self::ISSUE_SUBFAIL:
@@ -144,13 +153,15 @@ public static function getIssueStatus($issue) {
144153
case self::ISSUE_SUBFAIL:
145154
return self::STATUS_FAIL;
146155
case self::ISSUE_SURPLUS:
147-
case self::ISSUE_CHARSET:
148-
case self::ISSUE_COLLATION:
149156
case self::ISSUE_COLUMNTYPE:
150157
case self::ISSUE_SUBWARN:
151158
case self::ISSUE_KEYCOLUMNS:
152159
case self::ISSUE_NULLABLE:
153160
return self::STATUS_WARN;
161+
case self::ISSUE_SUBNOTE:
162+
case self::ISSUE_CHARSET:
163+
case self::ISSUE_COLLATION:
164+
return self::STATUS_NOTE;
154165
default:
155166
throw new Exception(pht('Unknown schema issue "%s"!', $issue));
156167
}
@@ -159,8 +170,10 @@ public static function getIssueStatus($issue) {
159170
public static function getStatusSeverity($status) {
160171
switch ($status) {
161172
case self::STATUS_FAIL:
162-
return 2;
173+
return 3;
163174
case self::STATUS_WARN:
175+
return 2;
176+
case self::STATUS_NOTE:
164177
return 1;
165178
case self::STATUS_OKAY:
166179
return 0;

‎src/applications/dashboard/storage/PhabricatorDashboard.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ public function getConfiguration() {
3939
return array(
4040
self::CONFIG_AUX_PHID => true,
4141
self::CONFIG_SERIALIZATION => array(
42-
'layoutConfig' => self::SERIALIZATION_JSON),
42+
'layoutConfig' => self::SERIALIZATION_JSON,
43+
),
44+
self::CONFIG_COLUMN_SCHEMA => array(
45+
'name' => 'text255',
46+
),
4347
) + parent::getConfiguration();
4448
}
4549

‎src/applications/dashboard/storage/PhabricatorDashboardInstall.php

+13
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ final class PhabricatorDashboardInstall
1414
protected $applicationClass;
1515
protected $dashboardPHID;
1616

17+
public function getConfiguration() {
18+
return array(
19+
self::CONFIG_COLUMN_SCHEMA => array(
20+
'applicationClass' => 'text64',
21+
),
22+
self::CONFIG_KEY_SCHEMA => array(
23+
'objectPHID' => array(
24+
'columns' => array('objectPHID', 'applicationClass'),
25+
),
26+
),
27+
) + parent::getConfiguration();
28+
}
29+
1730
public static function getDashboard(
1831
PhabricatorUser $viewer,
1932
$object_phid,

‎src/applications/dashboard/storage/PhabricatorDashboardPanel.php

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public function getConfiguration() {
4343
self::CONFIG_SERIALIZATION => array(
4444
'properties' => self::SERIALIZATION_JSON,
4545
),
46+
self::CONFIG_COLUMN_SCHEMA => array(
47+
'name' => 'text255',
48+
'panelType' => 'text64',
49+
'isArchived' => 'bool',
50+
),
4651
) + parent::getConfiguration();
4752
}
4853

‎src/applications/doorkeeper/storage/DoorkeeperExternalObject.php

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ public function getConfiguration() {
1919
self::CONFIG_SERIALIZATION => array(
2020
'properties' => self::SERIALIZATION_JSON,
2121
),
22+
self::CONFIG_COLUMN_SCHEMA => array(
23+
'objectKey' => 'bytes12',
24+
'applicationType' => 'text32',
25+
'applicationDomain' => 'text32',
26+
'objectType' => 'text32',
27+
'objectID' => 'text64',
28+
'objectURI' => 'text128?',
29+
'importerPHID' => 'phid?',
30+
),
31+
self::CONFIG_KEY_SCHEMA => array(
32+
'key_object' => array(
33+
'columns' => array('objectKey'),
34+
),
35+
),
2236
) + parent::getConfiguration();
2337
}
2438

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
final class DoorkeeperSchemaSpec
4+
extends PhabricatorConfigSchemaSpec {
5+
6+
public function buildSchemata() {
7+
$this->buildLiskSchemata('DoorkeeperDAO');
8+
9+
$this->buildEdgeSchemata(new DoorkeeperExternalObject());
10+
}
11+
12+
}

‎src/applications/draft/storage/PhabricatorDraft.php

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ public function getConfiguration() {
1414
self::CONFIG_SERIALIZATION => array(
1515
'metadata' => self::SERIALIZATION_JSON,
1616
),
17+
self::CONFIG_COLUMN_SCHEMA => array(
18+
'draftKey' => 'text64',
19+
'draft' => 'text',
20+
),
21+
self::CONFIG_KEY_SCHEMA => array(
22+
'authorPHID' => array(
23+
'columns' => array('authorPHID', 'draftKey'),
24+
),
25+
),
1726
) + parent::getConfiguration();
1827
}
1928

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
final class PhabricatorDraftSchemaSpec
4+
extends PhabricatorConfigSchemaSpec {
5+
6+
public function buildSchemata() {
7+
$this->buildLiskSchemata('PhabricatorDraftDAO');
8+
}
9+
10+
}

‎src/applications/drydock/storage/DrydockBlueprint.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public function getConfiguration() {
3636
self::CONFIG_AUX_PHID => true,
3737
self::CONFIG_SERIALIZATION => array(
3838
'details' => self::SERIALIZATION_JSON,
39-
)
39+
),
40+
self::CONFIG_COLUMN_SCHEMA => array(
41+
'className' => 'text255',
42+
'blueprintName' => 'text255',
43+
),
4044
) + parent::getConfiguration();
4145
}
4246

‎src/applications/drydock/storage/DrydockLease.php

+14
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ public function getConfiguration() {
4343
self::CONFIG_SERIALIZATION => array(
4444
'attributes' => self::SERIALIZATION_JSON,
4545
),
46+
self::CONFIG_COLUMN_SCHEMA => array(
47+
'status' => 'uint32',
48+
'until' => 'epoch?',
49+
'resourceType' => 'text128',
50+
'taskID' => 'id?',
51+
'ownerPHID' => 'phid?',
52+
'resourceID' => 'id?',
53+
),
54+
self::CONFIG_KEY_SCHEMA => array(
55+
'key_phid' => null,
56+
'phid' => array(
57+
'columns' => array('phid'),
58+
),
59+
),
4660
) + parent::getConfiguration();
4761
}
4862

‎src/applications/drydock/storage/DrydockLog.php

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ final class DrydockLog extends DrydockDAO
1414
public function getConfiguration() {
1515
return array(
1616
self::CONFIG_TIMESTAMPS => false,
17+
self::CONFIG_COLUMN_SCHEMA => array(
18+
'resourceID' => 'id?',
19+
'leaseID' => 'id?',
20+
'message' => 'text',
21+
),
1722
) + parent::getConfiguration();
1823
}
1924

‎src/applications/drydock/storage/DrydockResource.php

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ public function getConfiguration() {
2323
'attributes' => self::SERIALIZATION_JSON,
2424
'capabilities' => self::SERIALIZATION_JSON,
2525
),
26+
self::CONFIG_COLUMN_SCHEMA => array(
27+
'name' => 'text255',
28+
'ownerPHID' => 'phid?',
29+
'status' => 'uint32',
30+
'type' => 'text64',
31+
),
32+
self::CONFIG_KEY_SCHEMA => array(
33+
'key_phid' => null,
34+
'phid' => array(
35+
'columns' => array('phid'),
36+
),
37+
),
2638
) + parent::getConfiguration();
2739
}
2840

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
final class DrydockSchemaSpec
4+
extends PhabricatorConfigSchemaSpec {
5+
6+
public function buildSchemata() {
7+
$this->buildLiskSchemata('DrydockDAO');
8+
9+
$this->buildTransactionSchema(
10+
new DrydockBlueprintTransaction());
11+
12+
}
13+
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
final class PhabricatorFeedSchemaSpec
4+
extends PhabricatorConfigSchemaSpec {
5+
6+
public function buildSchemata() {
7+
$this->buildLiskSchemata('PhabricatorFeedDAO');
8+
}
9+
10+
}

‎src/applications/feed/storage/PhabricatorFeedStoryData.php

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ public function getConfiguration() {
1515
self::CONFIG_SERIALIZATION => array(
1616
'storyData' => self::SERIALIZATION_JSON,
1717
),
18+
self::CONFIG_COLUMN_SCHEMA => array(
19+
'chronologicalKey' => 'uint64',
20+
'storyType' => 'text64',
21+
),
22+
self::CONFIG_KEY_SCHEMA => array(
23+
'key_phid' => null,
24+
'phid' => array(
25+
'columns' => array('phid'),
26+
),
27+
'chronologicalKey' => array(
28+
'columns' => array('chronologicalKey'),
29+
),
30+
),
1831
) + parent::getConfiguration();
1932
}
2033

0 commit comments

Comments
 (0)
Failed to load comments.