diff --git a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php --- a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php +++ b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php @@ -24,6 +24,7 @@ public function getConfiguration() { $config = parent::getConfiguration(); + $config[self::CONFIG_COLUMN_SCHEMA] = array( 'commitPHID' => 'phid?', 'pathID' => 'id?', @@ -35,6 +36,22 @@ '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 --- a/src/applications/auth/storage/PhabricatorAuthFactorConfig.php +++ b/src/applications/auth/storage/PhabricatorAuthFactorConfig.php @@ -19,6 +19,11 @@ '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 --- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php +++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php @@ -40,6 +40,15 @@ '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 --- a/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php +++ b/src/applications/auth/storage/PhabricatorAuthTemporaryToken.php @@ -22,6 +22,10 @@ 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 --- a/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php +++ b/src/applications/cache/storage/PhabricatorCacheSchemaSpec.php @@ -20,9 +20,17 @@ 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 --- a/src/applications/cache/storage/PhabricatorMarkupCache.php +++ b/src/applications/cache/storage/PhabricatorMarkupCache.php @@ -21,6 +21,10 @@ 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 --- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php +++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php @@ -43,6 +43,11 @@ '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 --- a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php +++ b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php @@ -15,6 +15,7 @@ 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 --- a/src/applications/chatlog/storage/PhabricatorChatLogChannel.php +++ b/src/applications/chatlog/storage/PhabricatorChatLogChannel.php @@ -20,6 +20,7 @@ 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 --- a/src/applications/chatlog/storage/PhabricatorChatLogEvent.php +++ b/src/applications/chatlog/storage/PhabricatorChatLogEvent.php @@ -21,6 +21,11 @@ '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 --- a/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php +++ b/src/applications/conduit/storage/PhabricatorConduitCertificateToken.php @@ -13,9 +13,11 @@ 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 --- a/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php +++ b/src/applications/conduit/storage/PhabricatorConduitConnectionLog.php @@ -15,6 +15,11 @@ '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 --- a/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php +++ b/src/applications/conduit/storage/PhabricatorConduitMethodCallLog.php @@ -20,6 +20,17 @@ '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 --- a/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php +++ b/src/applications/config/controller/PhabricatorConfigDatabaseIssueController.php @@ -89,10 +89,17 @@ 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 --- a/src/applications/config/schema/PhabricatorConfigStorageSchema.php +++ b/src/applications/config/schema/PhabricatorConfigStorageSchema.php @@ -169,20 +169,20 @@ 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 --- a/src/applications/config/storage/PhabricatorConfigEntry.php +++ b/src/applications/config/storage/PhabricatorConfigEntry.php @@ -22,6 +22,7 @@ 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 --- a/src/applications/conpherence/storage/ConpherenceParticipant.php +++ b/src/applications/conpherence/storage/ConpherenceParticipant.php @@ -23,6 +23,13 @@ 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 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -36,6 +36,7 @@ '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 --- a/src/applications/conpherence/storage/ConpherenceTransactionComment.php +++ b/src/applications/conpherence/storage/ConpherenceTransactionComment.php @@ -11,9 +11,18 @@ 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 --- a/src/applications/daemon/storage/PhabricatorDaemonLog.php +++ b/src/applications/daemon/storage/PhabricatorDaemonLog.php @@ -31,6 +31,14 @@ '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 --- a/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php +++ b/src/applications/daemon/storage/PhabricatorDaemonLogEvent.php @@ -14,6 +14,11 @@ '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 --- a/src/applications/dashboard/storage/PhabricatorDashboardInstall.php +++ b/src/applications/dashboard/storage/PhabricatorDashboardInstall.php @@ -22,6 +22,7 @@ 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 --- a/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php +++ b/src/applications/doorkeeper/storage/DoorkeeperExternalObject.php @@ -31,6 +31,15 @@ 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 --- a/src/applications/draft/storage/PhabricatorDraft.php +++ b/src/applications/draft/storage/PhabricatorDraft.php @@ -21,6 +21,7 @@ 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 --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -55,6 +55,7 @@ '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 --- a/src/applications/drydock/storage/DrydockLog.php +++ b/src/applications/drydock/storage/DrydockLog.php @@ -19,6 +19,17 @@ '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 --- a/src/applications/drydock/storage/DrydockResource.php +++ b/src/applications/drydock/storage/DrydockResource.php @@ -33,6 +33,7 @@ '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 --- a/src/applications/feed/storage/PhabricatorFeedStoryData.php +++ b/src/applications/feed/storage/PhabricatorFeedStoryData.php @@ -23,9 +23,11 @@ '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 --- a/src/applications/feed/storage/PhabricatorFeedStoryReference.php +++ b/src/applications/feed/storage/PhabricatorFeedStoryReference.php @@ -17,6 +17,10 @@ '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 --- a/src/applications/files/storage/PhabricatorFile.php +++ b/src/applications/files/storage/PhabricatorFile.php @@ -68,7 +68,7 @@ self::CONFIG_COLUMN_SCHEMA => array( 'name' => 'text255?', 'mimeType' => 'text255?', - 'byteSize' => 'uint64?', + 'byteSize' => 'uint64', 'storageEngine' => 'text32', 'storageFormat' => 'text32', 'storageHandle' => 'text255', @@ -83,6 +83,19 @@ '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 --- a/src/applications/files/storage/PhabricatorFileTransactionComment.php +++ b/src/applications/files/storage/PhabricatorFileTransactionComment.php @@ -17,6 +17,7 @@ $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 --- a/src/applications/files/storage/PhabricatorTransformedFile.php +++ b/src/applications/files/storage/PhabricatorTransformedFile.php @@ -14,6 +14,10 @@ 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 --- a/src/applications/flag/storage/PhabricatorFlag.php +++ b/src/applications/flag/storage/PhabricatorFlag.php @@ -23,6 +23,10 @@ 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 --- a/src/applications/fund/storage/FundBacker.php +++ b/src/applications/fund/storage/FundBacker.php @@ -32,6 +32,14 @@ '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 --- a/src/applications/fund/storage/FundInitiative.php +++ b/src/applications/fund/storage/FundInitiative.php @@ -53,6 +53,14 @@ '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 --- a/src/applications/herald/storage/transcript/HeraldTranscript.php +++ b/src/applications/herald/storage/transcript/HeraldTranscript.php @@ -16,6 +16,7 @@ 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 --- a/src/applications/legalpad/storage/LegalpadDocument.php +++ b/src/applications/legalpad/storage/LegalpadDocument.php @@ -62,6 +62,11 @@ '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 --- a/src/applications/legalpad/storage/LegalpadDocumentBody.php +++ b/src/applications/legalpad/storage/LegalpadDocumentBody.php @@ -24,6 +24,7 @@ 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 --- a/src/applications/legalpad/storage/LegalpadDocumentSignature.php +++ b/src/applications/legalpad/storage/LegalpadDocumentSignature.php @@ -37,6 +37,17 @@ '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 --- a/src/applications/legalpad/storage/LegalpadTransactionComment.php +++ b/src/applications/legalpad/storage/LegalpadTransactionComment.php @@ -32,6 +32,7 @@ $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 --- a/src/applications/macro/storage/PhabricatorFileImageMacro.php +++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php @@ -54,6 +54,13 @@ 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 --- a/src/applications/notification/storage/PhabricatorFeedStoryNotification.php +++ b/src/applications/notification/storage/PhabricatorFeedStoryNotification.php @@ -20,6 +20,10 @@ '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 --- a/src/applications/nuance/storage/NuanceRequestorSource.php +++ b/src/applications/nuance/storage/NuanceRequestorSource.php @@ -5,6 +5,7 @@ protected $requestorPHID; protected $sourcePHID; + protected $sourceKey; protected $data; public function getConfiguration() { @@ -12,6 +13,21 @@ 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 --- a/src/applications/pholio/storage/PholioTransactionComment.php +++ b/src/applications/pholio/storage/PholioTransactionComment.php @@ -28,6 +28,7 @@ $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 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteChoice.php @@ -6,4 +6,17 @@ 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 --- a/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvoteOption.php @@ -10,6 +10,11 @@ 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 --- a/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php +++ b/src/applications/slowvote/storage/PhabricatorSlowvotePoll.php @@ -58,6 +58,7 @@ '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 --- a/src/applications/system/storage/PhabricatorSystemActionLog.php +++ b/src/applications/system/storage/PhabricatorSystemActionLog.php @@ -17,6 +17,14 @@ '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 --- a/src/applications/system/storage/PhabricatorSystemDestructionLog.php +++ b/src/applications/system/storage/PhabricatorSystemDestructionLog.php @@ -17,6 +17,11 @@ '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 --- a/src/applications/tokens/storage/PhabricatorTokenCount.php +++ b/src/applications/tokens/storage/PhabricatorTokenCount.php @@ -15,6 +15,10 @@ 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 --- a/src/applications/tokens/storage/PhabricatorTokenGiven.php +++ b/src/applications/tokens/storage/PhabricatorTokenGiven.php @@ -14,6 +14,13 @@ 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 --- a/src/applications/xhprof/storage/PhabricatorXHProfSample.php +++ b/src/applications/xhprof/storage/PhabricatorXHProfSample.php @@ -23,6 +23,7 @@ self::CONFIG_KEY_SCHEMA => array( 'filePHID' => array( 'columns' => array('filePHID'), + 'unique' => true, ), ), ) + parent::getConfiguration();