From 943c62d1e9f6b2c85302fedb004912a2e9c28450 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 1 Oct 2014 07:53:50 -0700 Subject: [PATCH] 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 --- .../PhabricatorAuditTransactionComment.php | 17 +++++++++++++++++ .../storage/PhabricatorAuthFactorConfig.php | 5 +++++ .../storage/PhabricatorAuthProviderConfig.php | 9 +++++++++ .../storage/PhabricatorAuthTemporaryToken.php | 4 ++++ .../storage/PhabricatorCacheSchemaSpec.php | 8 ++++++++ .../cache/storage/PhabricatorMarkupCache.php | 4 ++++ .../storage/PhabricatorCalendarEvent.php | 5 +++++ .../storage/PhabricatorCalendarHoliday.php | 1 + .../storage/PhabricatorChatLogChannel.php | 1 + .../chatlog/storage/PhabricatorChatLogEvent.php | 5 +++++ .../PhabricatorConduitCertificateToken.php | 2 ++ .../storage/PhabricatorConduitConnectionLog.php | 5 +++++ .../storage/PhabricatorConduitMethodCallLog.php | 11 +++++++++++ ...PhabricatorConfigDatabaseIssueController.php | 9 ++++++++- .../schema/PhabricatorConfigStorageSchema.php | 8 ++++---- .../config/storage/PhabricatorConfigEntry.php | 1 + .../storage/ConpherenceParticipant.php | 7 +++++++ .../conpherence/storage/ConpherenceThread.php | 1 + .../storage/ConpherenceTransactionComment.php | 9 +++++++++ .../daemon/storage/PhabricatorDaemonLog.php | 8 ++++++++ .../storage/PhabricatorDaemonLogEvent.php | 5 +++++ .../storage/PhabricatorDashboardInstall.php | 1 + .../storage/DoorkeeperExternalObject.php | 9 +++++++++ .../draft/storage/PhabricatorDraft.php | 1 + .../drydock/storage/DrydockLease.php | 1 + src/applications/drydock/storage/DrydockLog.php | 11 +++++++++++ .../drydock/storage/DrydockResource.php | 1 + .../feed/storage/PhabricatorFeedStoryData.php | 2 ++ .../storage/PhabricatorFeedStoryReference.php | 4 ++++ .../files/storage/PhabricatorFile.php | 15 ++++++++++++++- .../PhabricatorFileTransactionComment.php | 1 + .../storage/PhabricatorTransformedFile.php | 4 ++++ .../flag/storage/PhabricatorFlag.php | 4 ++++ src/applications/fund/storage/FundBacker.php | 8 ++++++++ .../fund/storage/FundInitiative.php | 8 ++++++++ .../storage/transcript/HeraldTranscript.php | 1 + .../legalpad/storage/LegalpadDocument.php | 5 +++++ .../legalpad/storage/LegalpadDocumentBody.php | 1 + .../storage/LegalpadDocumentSignature.php | 11 +++++++++++ .../storage/LegalpadTransactionComment.php | 1 + .../macro/storage/PhabricatorFileImageMacro.php | 7 +++++++ .../PhabricatorFeedStoryNotification.php | 4 ++++ .../nuance/storage/NuanceRequestorSource.php | 16 ++++++++++++++++ .../pholio/storage/PholioTransactionComment.php | 1 + .../storage/PhabricatorSlowvoteChoice.php | 13 +++++++++++++ .../storage/PhabricatorSlowvoteOption.php | 5 +++++ .../storage/PhabricatorSlowvotePoll.php | 1 + .../storage/PhabricatorSystemActionLog.php | 8 ++++++++ .../storage/PhabricatorSystemDestructionLog.php | 5 +++++ .../tokens/storage/PhabricatorTokenCount.php | 4 ++++ .../tokens/storage/PhabricatorTokenGiven.php | 7 +++++++ .../xhprof/storage/PhabricatorXHProfSample.php | 1 + 52 files changed, 280 insertions(+), 6 deletions(-) diff --git a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php index 7b5cebbc39..55508d6243 100644 --- a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php +++ b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php @@ -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; } diff --git a/src/applications/auth/storage/PhabricatorAuthFactorConfig.php b/src/applications/auth/storage/PhabricatorAuthFactorConfig.php index 662ab9f47e..2e2870ef65 100644 --- a/src/applications/auth/storage/PhabricatorAuthFactorConfig.php +++ b/src/applications/auth/storage/PhabricatorAuthFactorConfig.php @@ -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(); } diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php index 7dd425f477..c60aace712 100644 --- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php +++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php @@ -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(); } diff --git a/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php b/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php index 43a617d810..8a71f6024b 100644 --- a/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php +++ b/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php @@ -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(); diff --git a/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php b/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php index ed481a25df..4abd8fd388 100644 --- a/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php +++ b/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php @@ -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'), ), )); diff --git a/src/applications/cache/storage/PhabricatorMarkupCache.php b/src/applications/cache/storage/PhabricatorMarkupCache.php index a67e4d63ff..e4f7f6722a 100644 --- a/src/applications/cache/storage/PhabricatorMarkupCache.php +++ b/src/applications/cache/storage/PhabricatorMarkupCache.php @@ -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(); diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php index 481e5112b5..aba4fdbc96 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -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(); } diff --git a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php index e6d6a2c708..71549a1c0e 100644 --- a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php +++ b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php @@ -15,6 +15,7 @@ final class PhabricatorCalendarHoliday extends PhabricatorCalendarDAO { self::CONFIG_KEY_SCHEMA => array( 'day' => array( 'columns' => array('day'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/chatlog/storage/PhabricatorChatLogChannel.php b/src/applications/chatlog/storage/PhabricatorChatLogChannel.php index ce6117185a..7416f7b4e6 100644 --- a/src/applications/chatlog/storage/PhabricatorChatLogChannel.php +++ b/src/applications/chatlog/storage/PhabricatorChatLogChannel.php @@ -20,6 +20,7 @@ final class PhabricatorChatLogChannel self::CONFIG_KEY_SCHEMA => array( 'key_channel' => array( 'columns' => array('channelName', 'serviceType', 'serviceName'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/chatlog/storage/PhabricatorChatLogEvent.php b/src/applications/chatlog/storage/PhabricatorChatLogEvent.php index 68c6968f77..39fd1d37e9 100644 --- a/src/applications/chatlog/storage/PhabricatorChatLogEvent.php +++ b/src/applications/chatlog/storage/PhabricatorChatLogEvent.php @@ -21,6 +21,11 @@ final class PhabricatorChatLogEvent 'type' => 'text4', 'message' => 'text', ), + self::CONFIG_KEY_SCHEMA => array( + 'channel' => array( + 'columns' => array('epoch'), + ), + ), ) + parent::getConfiguration(); } diff --git a/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php b/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php index c324e4fc08..0baf243e9a 100644 --- a/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php +++ b/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php @@ -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(); diff --git a/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php b/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php index 0d47fcf735..9f4bcf0be0 100644 --- a/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php +++ b/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php @@ -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(); } diff --git a/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php b/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php index c3be27440b..6d6f3dfc4f 100644 --- a/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php +++ b/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php @@ -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(); } diff --git a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php index 199529e684..1997d660be 100644 --- a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php +++ b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php @@ -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], diff --git a/src/applications/config/schema/PhabricatorConfigStorageSchema.php b/src/applications/config/schema/PhabricatorConfigStorageSchema.php index 9b4d9ee2b9..8b59d8f1fe 100644 --- a/src/applications/config/schema/PhabricatorConfigStorageSchema.php +++ b/src/applications/config/schema/PhabricatorConfigStorageSchema.php @@ -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)); diff --git a/src/applications/config/storage/PhabricatorConfigEntry.php b/src/applications/config/storage/PhabricatorConfigEntry.php index 823fe50b00..47801247a2 100644 --- a/src/applications/config/storage/PhabricatorConfigEntry.php +++ b/src/applications/config/storage/PhabricatorConfigEntry.php @@ -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(); diff --git a/src/applications/conpherence/storage/ConpherenceParticipant.php b/src/applications/conpherence/storage/ConpherenceParticipant.php index 1310af135a..d8687d2ef8 100644 --- a/src/applications/conpherence/storage/ConpherenceParticipant.php +++ b/src/applications/conpherence/storage/ConpherenceParticipant.php @@ -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(); diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index 162442db46..629ed9b0e5 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -36,6 +36,7 @@ final class ConpherenceThread extends ConpherenceDAO 'key_phid' => null, 'phid' => array( 'columns' => array('phid'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/conpherence/storage/ConpherenceTransactionComment.php b/src/applications/conpherence/storage/ConpherenceTransactionComment.php index 958731e855..50169d7cd3 100644 --- a/src/applications/conpherence/storage/ConpherenceTransactionComment.php +++ b/src/applications/conpherence/storage/ConpherenceTransactionComment.php @@ -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; } diff --git a/src/applications/daemon/storage/PhabricatorDaemonLog.php b/src/applications/daemon/storage/PhabricatorDaemonLog.php index a4f89c8477..641ab3aabd 100644 --- a/src/applications/daemon/storage/PhabricatorDaemonLog.php +++ b/src/applications/daemon/storage/PhabricatorDaemonLog.php @@ -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(); } diff --git a/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php b/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php index 6be65dd784..fd1110ae06 100644 --- a/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php +++ b/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php @@ -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(); } diff --git a/src/applications/dashboard/storage/PhabricatorDashboardInstall.php b/src/applications/dashboard/storage/PhabricatorDashboardInstall.php index 0064beb8bd..0f108fbac8 100644 --- a/src/applications/dashboard/storage/PhabricatorDashboardInstall.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardInstall.php @@ -22,6 +22,7 @@ final class PhabricatorDashboardInstall self::CONFIG_KEY_SCHEMA => array( 'objectPHID' => array( 'columns' => array('objectPHID', 'applicationClass'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php b/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php index ce0a4f5eae..3719462ffb 100644 --- a/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php +++ b/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php @@ -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(); diff --git a/src/applications/draft/storage/PhabricatorDraft.php b/src/applications/draft/storage/PhabricatorDraft.php index e8d3748431..129d999298 100644 --- a/src/applications/draft/storage/PhabricatorDraft.php +++ b/src/applications/draft/storage/PhabricatorDraft.php @@ -21,6 +21,7 @@ final class PhabricatorDraft extends PhabricatorDraftDAO { self::CONFIG_KEY_SCHEMA => array( 'authorPHID' => array( 'columns' => array('authorPHID', 'draftKey'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php index 6a971629e8..b9e79fe820 100644 --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -55,6 +55,7 @@ final class DrydockLease extends DrydockDAO 'key_phid' => null, 'phid' => array( 'columns' => array('phid'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/drydock/storage/DrydockLog.php b/src/applications/drydock/storage/DrydockLog.php index 1faa6f9bc4..763d531e42 100644 --- a/src/applications/drydock/storage/DrydockLog.php +++ b/src/applications/drydock/storage/DrydockLog.php @@ -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(); } diff --git a/src/applications/drydock/storage/DrydockResource.php b/src/applications/drydock/storage/DrydockResource.php index 0ad17d303f..84b8bc6d69 100644 --- a/src/applications/drydock/storage/DrydockResource.php +++ b/src/applications/drydock/storage/DrydockResource.php @@ -33,6 +33,7 @@ final class DrydockResource extends DrydockDAO 'key_phid' => null, 'phid' => array( 'columns' => array('phid'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/feed/storage/PhabricatorFeedStoryData.php b/src/applications/feed/storage/PhabricatorFeedStoryData.php index 161d8fe896..bf0aba84be 100644 --- a/src/applications/feed/storage/PhabricatorFeedStoryData.php +++ b/src/applications/feed/storage/PhabricatorFeedStoryData.php @@ -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(); diff --git a/src/applications/feed/storage/PhabricatorFeedStoryReference.php b/src/applications/feed/storage/PhabricatorFeedStoryReference.php index f4b980a4a0..c5740b542d 100644 --- a/src/applications/feed/storage/PhabricatorFeedStoryReference.php +++ b/src/applications/feed/storage/PhabricatorFeedStoryReference.php @@ -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(); diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php index a6171a4f39..703886f5d4 100644 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -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(); diff --git a/src/applications/files/storage/PhabricatorFileTransactionComment.php b/src/applications/files/storage/PhabricatorFileTransactionComment.php index 57fa7d7a33..f1a2211f7a 100644 --- a/src/applications/files/storage/PhabricatorFileTransactionComment.php +++ b/src/applications/files/storage/PhabricatorFileTransactionComment.php @@ -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; diff --git a/src/applications/files/storage/PhabricatorTransformedFile.php b/src/applications/files/storage/PhabricatorTransformedFile.php index 52dde89add..5b0f0e2f1d 100644 --- a/src/applications/files/storage/PhabricatorTransformedFile.php +++ b/src/applications/files/storage/PhabricatorTransformedFile.php @@ -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(); diff --git a/src/applications/flag/storage/PhabricatorFlag.php b/src/applications/flag/storage/PhabricatorFlag.php index 0ef56a916c..535b9a9e8e 100644 --- a/src/applications/flag/storage/PhabricatorFlag.php +++ b/src/applications/flag/storage/PhabricatorFlag.php @@ -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(); diff --git a/src/applications/fund/storage/FundBacker.php b/src/applications/fund/storage/FundBacker.php index 25b9765f01..ad34bbc9d8 100644 --- a/src/applications/fund/storage/FundBacker.php +++ b/src/applications/fund/storage/FundBacker.php @@ -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(); } diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php index 88d9ccea05..e0cb4b5fa8 100644 --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -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(); } diff --git a/src/applications/herald/storage/transcript/HeraldTranscript.php b/src/applications/herald/storage/transcript/HeraldTranscript.php index 06b6bc6345..cafae6a424 100644 --- a/src/applications/herald/storage/transcript/HeraldTranscript.php +++ b/src/applications/herald/storage/transcript/HeraldTranscript.php @@ -16,6 +16,7 @@ final class HeraldTranscript extends HeraldDAO protected $objectPHID; protected $dryRun; + protected $garbageCollected = 0; const TABLE_SAVED_HEADER = 'herald_savedheader'; diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php index 03285c1e3a..ca3b035cb0 100644 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -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(); } diff --git a/src/applications/legalpad/storage/LegalpadDocumentBody.php b/src/applications/legalpad/storage/LegalpadDocumentBody.php index 97a1eb1183..a4800f2192 100644 --- a/src/applications/legalpad/storage/LegalpadDocumentBody.php +++ b/src/applications/legalpad/storage/LegalpadDocumentBody.php @@ -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(); diff --git a/src/applications/legalpad/storage/LegalpadDocumentSignature.php b/src/applications/legalpad/storage/LegalpadDocumentSignature.php index 1a7d7dc824..e247073c6d 100644 --- a/src/applications/legalpad/storage/LegalpadDocumentSignature.php +++ b/src/applications/legalpad/storage/LegalpadDocumentSignature.php @@ -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(); } diff --git a/src/applications/legalpad/storage/LegalpadTransactionComment.php b/src/applications/legalpad/storage/LegalpadTransactionComment.php index 800303009e..d8315ddaad 100644 --- a/src/applications/legalpad/storage/LegalpadTransactionComment.php +++ b/src/applications/legalpad/storage/LegalpadTransactionComment.php @@ -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; diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php index 1ea5ac3704..61f0000779 100644 --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -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(); diff --git a/src/applications/notification/storage/PhabricatorFeedStoryNotification.php b/src/applications/notification/storage/PhabricatorFeedStoryNotification.php index dd500bb0d3..6018d02f8d 100644 --- a/src/applications/notification/storage/PhabricatorFeedStoryNotification.php +++ b/src/applications/notification/storage/PhabricatorFeedStoryNotification.php @@ -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(); diff --git a/src/applications/nuance/storage/NuanceRequestorSource.php b/src/applications/nuance/storage/NuanceRequestorSource.php index ea23bcc891..6c607a643c 100644 --- a/src/applications/nuance/storage/NuanceRequestorSource.php +++ b/src/applications/nuance/storage/NuanceRequestorSource.php @@ -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(); } diff --git a/src/applications/pholio/storage/PholioTransactionComment.php b/src/applications/pholio/storage/PholioTransactionComment.php index d5693e8a90..926b74eb7d 100644 --- a/src/applications/pholio/storage/PholioTransactionComment.php +++ b/src/applications/pholio/storage/PholioTransactionComment.php @@ -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]; diff --git a/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php b/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php index 3afaf910f5..c325b8ddc7 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php @@ -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(); + } + } diff --git a/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php b/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php index 97893632dc..bac8ab5332 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php @@ -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(); } diff --git a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php index 587ce1959e..6b677da2bb 100644 --- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php @@ -58,6 +58,7 @@ final class PhabricatorSlowvotePoll extends PhabricatorSlowvoteDAO 'key_phid' => null, 'phid' => array( 'columns' => array('phid'), + 'unique' => true, ), ), ) + parent::getConfiguration(); diff --git a/src/applications/system/storage/PhabricatorSystemActionLog.php b/src/applications/system/storage/PhabricatorSystemActionLog.php index 9b49759c00..438806a685 100644 --- a/src/applications/system/storage/PhabricatorSystemActionLog.php +++ b/src/applications/system/storage/PhabricatorSystemActionLog.php @@ -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(); } diff --git a/src/applications/system/storage/PhabricatorSystemDestructionLog.php b/src/applications/system/storage/PhabricatorSystemDestructionLog.php index fca4e04705..aca41a043c 100644 --- a/src/applications/system/storage/PhabricatorSystemDestructionLog.php +++ b/src/applications/system/storage/PhabricatorSystemDestructionLog.php @@ -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(); } diff --git a/src/applications/tokens/storage/PhabricatorTokenCount.php b/src/applications/tokens/storage/PhabricatorTokenCount.php index 6e057b76b1..c4be4407f0 100644 --- a/src/applications/tokens/storage/PhabricatorTokenCount.php +++ b/src/applications/tokens/storage/PhabricatorTokenCount.php @@ -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(); diff --git a/src/applications/tokens/storage/PhabricatorTokenGiven.php b/src/applications/tokens/storage/PhabricatorTokenGiven.php index f6a1b0153d..5be2044551 100644 --- a/src/applications/tokens/storage/PhabricatorTokenGiven.php +++ b/src/applications/tokens/storage/PhabricatorTokenGiven.php @@ -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(); diff --git a/src/applications/xhprof/storage/PhabricatorXHProfSample.php b/src/applications/xhprof/storage/PhabricatorXHProfSample.php index b0e56a7962..8d13a76534 100644 --- a/src/applications/xhprof/storage/PhabricatorXHProfSample.php +++ b/src/applications/xhprof/storage/PhabricatorXHProfSample.php @@ -23,6 +23,7 @@ final class PhabricatorXHProfSample extends PhabricatorXHProfDAO { self::CONFIG_KEY_SCHEMA => array( 'filePHID' => array( 'columns' => array('filePHID'), + 'unique' => true, ), ), ) + parent::getConfiguration();