1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Add missing expected keys and uniqueness

Summary:
Ref T1191.

  - Adds definitions for missing keys and keys with wrong uniqueness. Generally, I defined these before fixing the key query to actually pull all keys and support uniqueness.
  - Moves "key uniqueness" to note severity; this is fixable (probably?) and there are no remaining issues.
  - Moves "Missing Key" to note severity; missing keys are fixable and all remaining missing keys are really missing (either missing edge keys, or missing PHID keys):

{F210089}

  - Moves "Surplus Key" to note seveirty; surplus keys are fixable all remaining surplus keys are really surplus (duplicate key in Harbormaster, key on unused column in Worker):

{F210090}

Test Plan:
  - Vetted missing/surplus/unique messages.
  - 146 issues remaining.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10590
This commit is contained in:
epriestley 2014-10-01 07:53:50 -07:00
parent 2880732a49
commit 943c62d1e9
52 changed files with 280 additions and 6 deletions

View file

@ -24,6 +24,7 @@ final class PhabricatorAuditTransactionComment
public function getConfiguration() {
$config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array(
'commitPHID' => 'phid?',
'pathID' => 'id?',
@ -35,6 +36,22 @@ final class PhabricatorAuditTransactionComment
'replyToCommentPHID' => 'phid?',
'legacyCommentID' => 'id?',
) + $config[self::CONFIG_COLUMN_SCHEMA];
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_path' => array(
'columns' => array('pathID'),
),
'key_draft' => array(
'columns' => array('authorPHID', 'transactionPHID'),
),
'key_commit' => array(
'columns' => array('commitPHID'),
),
'key_legacy' => array(
'columns' => array('legacyCommentID'),
),
) + $config[self::CONFIG_KEY_SCHEMA];
return $config;
}

View file

@ -19,6 +19,11 @@ final class PhabricatorAuthFactorConfig extends PhabricatorAuthDAO {
'factorName' => 'text',
'factorSecret' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'key_user' => array(
'columns' => array('userPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -40,6 +40,15 @@ final class PhabricatorAuthProviderConfig extends PhabricatorAuthDAO
'shouldAllowUnlink' => 'bool',
'shouldTrustEmails' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
'key_provider' => array(
'columns' => array('providerType', 'providerDomain'),
'unique' => true,
),
'key_class' => array(
'columns' => array('providerClass'),
),
),
) + parent::getConfiguration();
}

View file

@ -22,6 +22,10 @@ final class PhabricatorAuthTemporaryToken extends PhabricatorAuthDAO
self::CONFIG_KEY_SCHEMA => array(
'key_token' => array(
'columns' => array('objectPHID', 'tokenType', 'tokenCode'),
'unique' => true,
),
'key_expires' => array(
'columns' => array('tokenExpires'),
),
),
) + parent::getConfiguration();

View file

@ -20,9 +20,17 @@ final class PhabricatorCacheSchemaSpec extends PhabricatorConfigSchemaSpec {
array(
'PRIMARY' => array(
'columns' => array('id'),
'unique' => true,
),
'key_cacheKeyHash' => array(
'columns' => array('cacheKeyHash'),
'unique' => true,
),
'key_cacheCreated' => array(
'columns' => array('cacheCreated'),
),
'key_ttl' => array(
'columns' => array('cacheExpires'),
),
));

View file

@ -21,6 +21,10 @@ final class PhabricatorMarkupCache extends PhabricatorCacheDAO {
self::CONFIG_KEY_SCHEMA => array(
'cacheKey' => array(
'columns' => array('cacheKey'),
'unique' => true,
),
'dateCreated' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();

View file

@ -43,6 +43,11 @@ final class PhabricatorCalendarEvent
'status' => 'uint32',
'description' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'userPHID_dateFrom' => array(
'columns' => array('userPHID', 'dateTo'),
),
),
) + parent::getConfiguration();
}

View file

@ -15,6 +15,7 @@ final class PhabricatorCalendarHoliday extends PhabricatorCalendarDAO {
self::CONFIG_KEY_SCHEMA => array(
'day' => array(
'columns' => array('day'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -20,6 +20,7 @@ final class PhabricatorChatLogChannel
self::CONFIG_KEY_SCHEMA => array(
'key_channel' => array(
'columns' => array('channelName', 'serviceType', 'serviceName'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -21,6 +21,11 @@ final class PhabricatorChatLogEvent
'type' => 'text4',
'message' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'channel' => array(
'columns' => array('epoch'),
),
),
) + parent::getConfiguration();
}

View file

@ -13,9 +13,11 @@ final class PhabricatorConduitCertificateToken extends PhabricatorConduitDAO {
self::CONFIG_KEY_SCHEMA => array(
'userPHID' => array(
'columns' => array('userPHID'),
'unique' => true,
),
'token' => array(
'columns' => array('token'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -15,6 +15,11 @@ final class PhabricatorConduitConnectionLog extends PhabricatorConduitDAO {
'clientDescription' => 'text255?',
'username' => 'text255?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_created' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();
}

View file

@ -20,6 +20,17 @@ final class PhabricatorConduitMethodCallLog
'duration' => 'uint64',
'callerPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_date' => array(
'columns' => array('dateCreated'),
),
'key_method' => array(
'columns' => array('method'),
),
'key_callermethod' => array(
'columns' => array('callerPHID', 'method'),
),
),
) + parent::getConfiguration();
}

View file

@ -89,10 +89,17 @@ final class PhabricatorConfigDatabaseIssueController
foreach ($issues as $issue) {
$const = $issue[4];
$database_link = phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('/database/'.$issue[0].'/'),
),
$issue[0]);
$rows[] = array(
$this->renderIcon(
PhabricatorConfigStorageSchema::getIssueStatus($const)),
$issue[0],
$database_link,
$issue[1],
$issue[2],
$issue[3],

View file

@ -169,20 +169,20 @@ abstract class PhabricatorConfigStorageSchema extends Phobject {
public static function getIssueStatus($issue) {
switch ($issue) {
case self::ISSUE_MISSING:
case self::ISSUE_MISSINGKEY:
case self::ISSUE_SUBFAIL:
return self::STATUS_FAIL;
case self::ISSUE_SURPLUS:
case self::ISSUE_SURPLUSKEY:
return self::STATUS_FAIL;
case self::ISSUE_SUBWARN:
case self::ISSUE_COLUMNTYPE:
case self::ISSUE_KEYCOLUMNS:
case self::ISSUE_UNIQUE:
case self::ISSUE_NULLABLE:
return self::STATUS_WARN;
case self::ISSUE_SUBNOTE:
case self::ISSUE_CHARSET:
case self::ISSUE_COLLATION:
case self::ISSUE_MISSINGKEY:
case self::ISSUE_SURPLUSKEY:
case self::ISSUE_UNIQUE:
return self::STATUS_NOTE;
default:
throw new Exception(pht('Unknown schema issue "%s"!', $issue));

View file

@ -22,6 +22,7 @@ final class PhabricatorConfigEntry extends PhabricatorConfigEntryDAO
self::CONFIG_KEY_SCHEMA => array(
'key_name' => array(
'columns' => array('namespace', 'configKey'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -23,6 +23,13 @@ final class ConpherenceParticipant extends ConpherenceDAO {
self::CONFIG_KEY_SCHEMA => array(
'conpherencePHID' => array(
'columns' => array('conpherencePHID', 'participantPHID'),
'unique' => true,
),
'unreadCount' => array(
'columns' => array('participantPHID', 'participationStatus'),
),
'participationIndex' => array(
'columns' => array('participantPHID', 'dateTouched', 'id'),
),
),
) + parent::getConfiguration();

View file

@ -36,6 +36,7 @@ final class ConpherenceThread extends ConpherenceDAO
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -11,9 +11,18 @@ final class ConpherenceTransactionComment
public function getConfiguration() {
$config = parent::getConfiguration();
$config[self::CONFIG_COLUMN_SCHEMA] = array(
'conpherencePHID' => 'phid?',
) + $config[self::CONFIG_COLUMN_SCHEMA];
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_draft' => array(
'columns' => array('authorPHID', 'conpherencePHID', 'transactionPHID'),
'unique' => true,
),
) + $config[self::CONFIG_KEY_SCHEMA];
return $config;
}

View file

@ -31,6 +31,14 @@ final class PhabricatorDaemonLog extends PhabricatorDaemonDAO
'envHash' => 'bytes40',
'status' => 'text8',
),
self::CONFIG_KEY_SCHEMA => array(
'status' => array(
'columns' => array('status'),
),
'dateCreated' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();
}

View file

@ -14,6 +14,11 @@ final class PhabricatorDaemonLogEvent extends PhabricatorDaemonDAO {
'logType' => 'text4',
'message' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'logID' => array(
'columns' => array('logID', 'epoch'),
),
),
) + parent::getConfiguration();
}

View file

@ -22,6 +22,7 @@ final class PhabricatorDashboardInstall
self::CONFIG_KEY_SCHEMA => array(
'objectPHID' => array(
'columns' => array('objectPHID', 'applicationClass'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -31,6 +31,15 @@ final class DoorkeeperExternalObject extends DoorkeeperDAO
self::CONFIG_KEY_SCHEMA => array(
'key_object' => array(
'columns' => array('objectKey'),
'unique' => true,
),
'key_full' => array(
'columns' => array(
'applicationType',
'applicationDomain',
'objectType',
'objectID',
),
),
),
) + parent::getConfiguration();

View file

@ -21,6 +21,7 @@ final class PhabricatorDraft extends PhabricatorDraftDAO {
self::CONFIG_KEY_SCHEMA => array(
'authorPHID' => array(
'columns' => array('authorPHID', 'draftKey'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -55,6 +55,7 @@ final class DrydockLease extends DrydockDAO
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -19,6 +19,17 @@ final class DrydockLog extends DrydockDAO
'leaseID' => 'id?',
'message' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'resourceID' => array(
'columns' => array('resourceID', 'epoch'),
),
'leaseID' => array(
'columns' => array('leaseID', 'epoch'),
),
'epoch' => array(
'columns' => array('epoch'),
),
),
) + parent::getConfiguration();
}

View file

@ -33,6 +33,7 @@ final class DrydockResource extends DrydockDAO
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -23,9 +23,11 @@ final class PhabricatorFeedStoryData extends PhabricatorFeedDAO {
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'chronologicalKey' => array(
'columns' => array('chronologicalKey'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -17,6 +17,10 @@ final class PhabricatorFeedStoryReference extends PhabricatorFeedDAO {
'PRIMARY' => null,
'objectPHID' => array(
'columns' => array('objectPHID', 'chronologicalKey'),
'unique' => true,
),
'chronologicalKey' => array(
'columns' => array('chronologicalKey'),
),
),
) + parent::getConfiguration();

View file

@ -68,7 +68,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255?',
'mimeType' => 'text255?',
'byteSize' => 'uint64?',
'byteSize' => 'uint64',
'storageEngine' => 'text32',
'storageFormat' => 'text32',
'storageHandle' => 'text255',
@ -83,6 +83,19 @@ final class PhabricatorFile extends PhabricatorFileDAO
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
'authorPHID' => array(
'columns' => array('authorPHID'),
),
'contentHash' => array(
'columns' => array('contentHash'),
),
'key_ttl' => array(
'columns' => array('ttl'),
),
'key_dateCreated' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();

View file

@ -17,6 +17,7 @@ final class PhabricatorFileTransactionComment
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_draft' => array(
'columns' => array('authorPHID', 'transactionPHID'),
'unique' => true,
),
) + $config[self::CONFIG_KEY_SCHEMA];
return $config;

View file

@ -14,6 +14,10 @@ final class PhabricatorTransformedFile extends PhabricatorFileDAO {
self::CONFIG_KEY_SCHEMA => array(
'originalPHID' => array(
'columns' => array('originalPHID', 'transform'),
'unique' => true,
),
'transformedPHID' => array(
'columns' => array('transformedPHID'),
),
),
) + parent::getConfiguration();

View file

@ -23,6 +23,10 @@ final class PhabricatorFlag extends PhabricatorFlagDAO
self::CONFIG_KEY_SCHEMA => array(
'ownerPHID' => array(
'columns' => array('ownerPHID', 'type', 'objectPHID'),
'unique' => true,
),
'objectPHID' => array(
'columns' => array('objectPHID'),
),
),
) + parent::getConfiguration();

View file

@ -32,6 +32,14 @@ final class FundBacker extends FundDAO
'status' => 'text32',
'amountInCents' => 'uint32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_initiative' => array(
'columns' => array('initiativePHID'),
),
'key_backer' => array(
'columns' => array('backerPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -53,6 +53,14 @@ final class FundInitiative extends FundDAO
'description' => 'text',
'status' => 'text32',
),
self::CONFIG_KEY_SCHEMA => array(
'key_status' => array(
'columns' => array('status'),
),
'key_owner' => array(
'columns' => array('ownerPHID'),
),
),
) + parent::getConfiguration();
}

View file

@ -16,6 +16,7 @@ final class HeraldTranscript extends HeraldDAO
protected $objectPHID;
protected $dryRun;
protected $garbageCollected = 0;
const TABLE_SAVED_HEADER = 'herald_savedheader';

View file

@ -62,6 +62,11 @@ final class LegalpadDocument extends LegalpadDAO
'signatureType' => 'text4',
'preamble' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'key_creator' => array(
'columns' => array('creatorPHID', 'dateModified'),
),
),
) + parent::getConfiguration();
}

View file

@ -24,6 +24,7 @@ final class LegalpadDocumentBody extends LegalpadDAO
self::CONFIG_KEY_SCHEMA => array(
'key_document' => array(
'columns' => array('documentPHID', 'version'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -37,6 +37,17 @@ final class LegalpadDocumentSignature
'isExemption' => 'bool',
'exemptionPHID' => 'phid?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_signer' => array(
'columns' => array('signerPHID', 'dateModified'),
),
'secretKey' => array(
'columns' => array('secretKey'),
),
'key_document' => array(
'columns' => array('documentPHID', 'signerPHID', 'documentVersion'),
),
),
) + parent::getConfiguration();
}

View file

@ -32,6 +32,7 @@ final class LegalpadTransactionComment
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_draft' => array(
'columns' => array('authorPHID', 'documentID', 'transactionPHID'),
'unique' => true,
),
) + $config[self::CONFIG_KEY_SCHEMA];
return $config;

View file

@ -54,6 +54,13 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO
self::CONFIG_KEY_SCHEMA => array(
'name' => array(
'columns' => array('name'),
'unique' => true,
),
'key_disabled' => array(
'columns' => array('isDisabled'),
),
'key_dateCreated' => array(
'columns' => array('dateCreated'),
),
),
) + parent::getConfiguration();

View file

@ -20,6 +20,10 @@ final class PhabricatorFeedStoryNotification extends PhabricatorFeedDAO {
'PRIMARY' => null,
'userPHID' => array(
'columns' => array('userPHID', 'chronologicalKey'),
'unique' => true,
),
'userPHID_2' => array(
'columns' => array('userPHID', 'hasViewed', 'primaryObjectPHID'),
),
),
) + parent::getConfiguration();

View file

@ -5,6 +5,7 @@ final class NuanceRequestorSource
protected $requestorPHID;
protected $sourcePHID;
protected $sourceKey;
protected $data;
public function getConfiguration() {
@ -12,6 +13,21 @@ final class NuanceRequestorSource
self::CONFIG_SERIALIZATION => array(
'data' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
'sourceKey' => 'text128',
),
self::CONFIG_KEY_SCHEMA => array(
'key_source_key' => array(
'columns' => array('sourcePHID', 'sourceKey'),
'unique' => true,
),
'key_requestor' => array(
'columns' => array('requestorPHID', 'id'),
),
'key_source' => array(
'columns' => array('sourcePHID', 'id'),
),
),
) + parent::getConfiguration();
}

View file

@ -28,6 +28,7 @@ final class PholioTransactionComment
$config[self::CONFIG_KEY_SCHEMA] = array(
'key_draft' => array(
'columns' => array('authorPHID', 'imageID', 'transactionPHID'),
'unique' => true,
),
) + $config[self::CONFIG_KEY_SCHEMA];

View file

@ -6,4 +6,17 @@ final class PhabricatorSlowvoteChoice extends PhabricatorSlowvoteDAO {
protected $optionID;
protected $authorPHID;
public function getConfiguration() {
return array(
self::CONFIG_KEY_SCHEMA => array(
'pollID' => array(
'columns' => array('pollID'),
),
'authorPHID' => array(
'columns' => array('authorPHID'),
),
),
) + parent::getConfiguration();
}
}

View file

@ -10,6 +10,11 @@ final class PhabricatorSlowvoteOption extends PhabricatorSlowvoteDAO {
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
),
self::CONFIG_KEY_SCHEMA => array(
'pollID' => array(
'columns' => array('pollID'),
),
),
) + parent::getConfiguration();
}

View file

@ -58,6 +58,7 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO
'key_phid' => null,
'phid' => array(
'columns' => array('phid'),
'unique' => true,
),
),
) + parent::getConfiguration();

View file

@ -17,6 +17,14 @@ final class PhabricatorSystemActionLog extends PhabricatorSystemDAO {
'action' => 'text32',
'score' => 'double',
),
self::CONFIG_KEY_SCHEMA => array(
'key_epoch' => array(
'columns' => array('epoch'),
),
'key_action' => array(
'columns' => array('actorHash', 'action', 'epoch'),
),
),
) + parent::getConfiguration();
}

View file

@ -17,6 +17,11 @@ final class PhabricatorSystemDestructionLog extends PhabricatorSystemDAO {
'objectPHID' => 'phid?',
'objectMonogram' => 'text64?',
),
self::CONFIG_KEY_SCHEMA => array(
'key_epoch' => array(
'columns' => array('epoch'),
),
),
) + parent::getConfiguration();
}

View file

@ -15,6 +15,10 @@ final class PhabricatorTokenCount extends PhabricatorTokenDAO {
self::CONFIG_KEY_SCHEMA => array(
'key_objectPHID' => array(
'columns' => array('objectPHID'),
'unique' => true,
),
'key_count' => array(
'columns' => array('tokenCount'),
),
),
) + parent::getConfiguration();

View file

@ -14,6 +14,13 @@ final class PhabricatorTokenGiven extends PhabricatorTokenDAO
self::CONFIG_KEY_SCHEMA => array(
'key_all' => array(
'columns' => array('objectPHID', 'authorPHID'),
'unique' => true,
),
'key_author' => array(
'columns' => array('authorPHID'),
),
'key_token' => array(
'columns' => array('tokenPHID'),
),
),
) + parent::getConfiguration();

View file

@ -23,6 +23,7 @@ final class PhabricatorXHProfSample extends PhabricatorXHProfDAO {
self::CONFIG_KEY_SCHEMA => array(
'filePHID' => array(
'columns' => array('filePHID'),
'unique' => true,
),
),
) + parent::getConfiguration();