@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Generate expected schemata for Repository

Summary: Ref T1191. Add specs for repository tables.

Test Plan: Saw ~300 fewer schema warnings.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T1191

Differential Revision: https://secure.phabricator.com/D10575

+401
+2
src/__phutil_library_map__.php
··· 2143 2143 'PhabricatorRepositoryRefCursorQuery' => 'applications/repository/query/PhabricatorRepositoryRefCursorQuery.php', 2144 2144 'PhabricatorRepositoryRefEngine' => 'applications/repository/engine/PhabricatorRepositoryRefEngine.php', 2145 2145 'PhabricatorRepositoryRepositoryPHIDType' => 'applications/repository/phid/PhabricatorRepositoryRepositoryPHIDType.php', 2146 + 'PhabricatorRepositorySchemaSpec' => 'applications/repository/storage/PhabricatorRepositorySchemaSpec.php', 2146 2147 'PhabricatorRepositorySearchEngine' => 'applications/repository/query/PhabricatorRepositorySearchEngine.php', 2147 2148 'PhabricatorRepositoryStatusMessage' => 'applications/repository/storage/PhabricatorRepositoryStatusMessage.php', 2148 2149 'PhabricatorRepositorySvnCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php', ··· 5139 5140 'PhabricatorRepositoryRefCursorQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 5140 5141 'PhabricatorRepositoryRefEngine' => 'PhabricatorRepositoryEngine', 5141 5142 'PhabricatorRepositoryRepositoryPHIDType' => 'PhabricatorPHIDType', 5143 + 'PhabricatorRepositorySchemaSpec' => 'PhabricatorConfigSchemaSpec', 5142 5144 'PhabricatorRepositorySearchEngine' => 'PhabricatorApplicationSearchEngine', 5143 5145 'PhabricatorRepositoryStatusMessage' => 'PhabricatorRepositoryDAO', 5144 5146 'PhabricatorRepositorySvnCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
+10
src/applications/config/schema/PhabricatorConfigSchemaSpec.php
··· 246 246 $charset = 'binary'; 247 247 $collation = 'binary'; 248 248 break; 249 + case 'bytes32': 250 + $column_type = 'char(32)'; 251 + $charset = 'binary'; 252 + $collation = 'binary'; 253 + break; 249 254 case 'bytes12': 250 255 $column_type = 'char(12)'; 251 256 $charset = 'binary'; ··· 263 268 break; 264 269 case 'text128': 265 270 $column_type = 'varchar(128)'; 271 + $charset = $this->getUTF8Charset(); 272 + $collation = $this->getUTF8Collation(); 273 + break; 274 + case 'text80': 275 + $column_type = 'varchar(80)'; 266 276 $charset = $this->getUTF8Charset(); 267 277 $collation = $this->getUTF8Collation(); 268 278 break;
+26
src/applications/repository/storage/PhabricatorRepository.php
··· 29 29 const TABLE_BADCOMMIT = 'repository_badcommit'; 30 30 const TABLE_LINTMESSAGE = 'repository_lintmessage'; 31 31 const TABLE_PARENTS = 'repository_parents'; 32 + const TABLE_COVERAGE = 'repository_coverage'; 32 33 33 34 const SERVE_OFF = 'off'; 34 35 const SERVE_READONLY = 'readonly'; ··· 76 77 self::CONFIG_AUX_PHID => true, 77 78 self::CONFIG_SERIALIZATION => array( 78 79 'details' => self::SERIALIZATION_JSON, 80 + ), 81 + self::CONFIG_COLUMN_SCHEMA => array( 82 + 'name' => 'text255', 83 + 'callsign' => 'text32', 84 + 'versionControlSystem' => 'text32', 85 + 'uuid' => 'text64?', 86 + 'pushPolicy' => 'policy', 87 + 'credentialPHID' => 'phid?', 88 + ), 89 + self::CONFIG_KEY_SCHEMA => array( 90 + 'key_phid' => null, 91 + 'phid' => array( 92 + 'columns' => array('phid'), 93 + 'unique' => true, 94 + ), 95 + 'callsign' => array( 96 + 'columns' => array('callsign'), 97 + 'unique' => true, 98 + ), 99 + 'key_name' => array( 100 + 'columns' => array('name'), 101 + ), 102 + 'key_vcs' => array( 103 + 'columns' => array('versionControlSystem'), 104 + ), 79 105 ), 80 106 ) + parent::getConfiguration(); 81 107 }
+15
src/applications/repository/storage/PhabricatorRepositoryArcanistProject.php
··· 22 22 'symbolIndexLanguages' => self::SERIALIZATION_JSON, 23 23 'symbolIndexProjects' => self::SERIALIZATION_JSON, 24 24 ), 25 + self::CONFIG_COLUMN_SCHEMA => array( 26 + 'name' => 'text255', 27 + 'repositoryID' => 'id?', 28 + ), 29 + self::CONFIG_KEY_SCHEMA => array( 30 + 'key_phid' => null, 31 + 'phid' => array( 32 + 'columns' => array('phid'), 33 + 'unique' => true, 34 + ), 35 + 'name' => array( 36 + 'columns' => array('name'), 37 + 'unique' => true, 38 + ), 39 + ), 25 40 ) + parent::getConfiguration(); 26 41 } 27 42
+11
src/applications/repository/storage/PhabricatorRepositoryAuditRequest.php
··· 17 17 self::CONFIG_SERIALIZATION => array( 18 18 'auditReasons' => self::SERIALIZATION_JSON, 19 19 ), 20 + self::CONFIG_COLUMN_SCHEMA => array( 21 + 'auditStatus' => 'text64', 22 + ), 23 + self::CONFIG_KEY_SCHEMA => array( 24 + 'commitPHID' => array( 25 + 'columns' => array('commitPHID'), 26 + ), 27 + 'auditorPHID' => array( 28 + 'columns' => array('auditorPHID', 'auditStatus'), 29 + ), 30 + ), 20 31 ) + parent::getConfiguration(); 21 32 } 22 33
+15
src/applications/repository/storage/PhabricatorRepositoryBranch.php
··· 6 6 protected $name; 7 7 protected $lintCommit; 8 8 9 + public function getConfiguration() { 10 + return array( 11 + self::CONFIG_COLUMN_SCHEMA => array( 12 + 'name' => 'text255', 13 + 'lintCommit' => 'text40?', 14 + ), 15 + self::CONFIG_KEY_SCHEMA => array( 16 + 'repositoryID' => array( 17 + 'columns' => array('repositoryID', 'name'), 18 + 'unique' => true, 19 + ), 20 + ), 21 + ) + parent::getConfiguration(); 22 + } 23 + 9 24 public static function loadBranch($repository_id, $branch_name) { 10 25 return id(new PhabricatorRepositoryBranch())->loadOneWhere( 11 26 'repositoryID = %d AND name = %s',
+28
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 66 66 return array( 67 67 self::CONFIG_AUX_PHID => true, 68 68 self::CONFIG_TIMESTAMPS => false, 69 + self::CONFIG_COLUMN_SCHEMA => array( 70 + 'commitIdentifier' => 'text40', 71 + 'mailKey' => 'bytes20', 72 + 'authorPHID' => 'phid?', 73 + 'auditStatus' => 'uint32', 74 + 'summary' => 'text80', 75 + 'importStatus' => 'uint32', 76 + ), 77 + self::CONFIG_KEY_SCHEMA => array( 78 + 'key_phid' => null, 79 + 'phid' => array( 80 + 'columns' => array('phid'), 81 + 'unique' => true, 82 + ), 83 + 'repositoryID' => array( 84 + 'columns' => array('repositoryID', 'importStatus'), 85 + ), 86 + 'authorPHID' => array( 87 + 'columns' => array('authorPHID', 'auditStatus', 'epoch'), 88 + ), 89 + 'repositoryID_2' => array( 90 + 'columns' => array('repositoryID', 'epoch'), 91 + ), 92 + 'key_commit_identity' => array( 93 + 'columns' => array('commitIdentifier', 'repositoryID'), 94 + 'unique' => true, 95 + ), 96 + ), 69 97 ) + parent::getConfiguration(); 70 98 } 71 99
+13
src/applications/repository/storage/PhabricatorRepositoryCommitData.php
··· 19 19 self::CONFIG_SERIALIZATION => array( 20 20 'commitDetails' => self::SERIALIZATION_JSON, 21 21 ), 22 + self::CONFIG_COLUMN_SCHEMA => array( 23 + 'authorName' => 'text255', 24 + 'commitMessage' => 'text', 25 + ), 26 + self::CONFIG_KEY_SCHEMA => array( 27 + 'commitID' => array( 28 + 'columns' => array('commitID'), 29 + 'unique' => true, 30 + ), 31 + 'authorName' => array( 32 + 'columns' => array('authorName'), 33 + ), 34 + ), 22 35 ) + parent::getConfiguration(); 23 36 } 24 37
+9
src/applications/repository/storage/PhabricatorRepositoryMirror.php
··· 17 17 public function getConfiguration() { 18 18 return array( 19 19 self::CONFIG_AUX_PHID => true, 20 + self::CONFIG_COLUMN_SCHEMA => array( 21 + 'remoteURI' => 'text255', 22 + 'credentialPHID' => 'phid?', 23 + ), 24 + self::CONFIG_KEY_SCHEMA => array( 25 + 'key_repository' => array( 26 + 'columns' => array('repositoryPHID'), 27 + ), 28 + ), 20 29 ) + parent::getConfiguration(); 21 30 } 22 31
+11
src/applications/repository/storage/PhabricatorRepositoryPushEvent.php
··· 28 28 return array( 29 29 self::CONFIG_AUX_PHID => true, 30 30 self::CONFIG_TIMESTAMPS => false, 31 + self::CONFIG_COLUMN_SCHEMA => array( 32 + 'remoteAddress' => 'uint32?', 33 + 'remoteProtocol' => 'text32?', 34 + 'rejectCode' => 'uint32', 35 + 'rejectDetails' => 'text64?', 36 + ), 37 + self::CONFIG_KEY_SCHEMA => array( 38 + 'key_repository' => array( 39 + 'columns' => array('repositoryPHID'), 40 + ), 41 + ), 31 42 ) + parent::getConfiguration(); 32 43 } 33 44
+27
src/applications/repository/storage/PhabricatorRepositoryPushLog.php
··· 71 71 self::CONFIG_BINARY => array( 72 72 'refNameRaw' => true, 73 73 ), 74 + self::CONFIG_COLUMN_SCHEMA => array( 75 + 'refType' => 'text12', 76 + 'refNameHash' => 'bytes12?', 77 + 'refNameRaw' => 'bytes?', 78 + 'refNameEncoding' => 'text16?', 79 + 'refOld' => 'text40?', 80 + 'refNew' => 'text40', 81 + 'mergeBase' => 'text40?', 82 + 'changeFlags' => 'uint32', 83 + ), 84 + self::CONFIG_KEY_SCHEMA => array( 85 + 'key_repository' => array( 86 + 'columns' => array('repositoryPHID'), 87 + ), 88 + 'key_ref' => array( 89 + 'columns' => array('repositoryPHID', 'refNew'), 90 + ), 91 + 'key_name' => array( 92 + 'columns' => array('repositoryPHID', 'refNameHash'), 93 + ), 94 + 'key_event' => array( 95 + 'columns' => array('pushEventPHID'), 96 + ), 97 + 'key_pusher' => array( 98 + 'columns' => array('pusherPHID'), 99 + ), 100 + ), 74 101 ) + parent::getConfiguration(); 75 102 } 76 103
+11
src/applications/repository/storage/PhabricatorRepositoryRefCursor.php
··· 27 27 self::CONFIG_BINARY => array( 28 28 'refNameRaw' => true, 29 29 ), 30 + self::CONFIG_COLUMN_SCHEMA => array( 31 + 'refType' => 'text32', 32 + 'refNameHash' => 'bytes12', 33 + 'refNameEncoding' => 'text16', 34 + 'commitIdentifier' => 'text40', 35 + ), 36 + self::CONFIG_KEY_SCHEMA => array( 37 + 'key_cursor' => array( 38 + 'columns' => array('repositoryPHID', 'refType', 'refNameHash'), 39 + ), 40 + ), 30 41 ) + parent::getConfiguration(); 31 42 } 32 43
+185
src/applications/repository/storage/PhabricatorRepositorySchemaSpec.php
··· 1 + <?php 2 + 3 + final class PhabricatorRepositorySchemaSpec 4 + extends PhabricatorConfigSchemaSpec { 5 + 6 + public function buildSchemata() { 7 + $this->buildLiskSchemata('PhabricatorRepositoryDAO'); 8 + 9 + $this->buildEdgeSchemata(new PhabricatorRepository()); 10 + 11 + $this->buildTransactionSchema( 12 + new PhabricatorRepositoryTransaction()); 13 + 14 + $this->buildRawSchema( 15 + id(new PhabricatorRepository())->getApplicationName(), 16 + PhabricatorRepository::TABLE_BADCOMMIT, 17 + array( 18 + 'fullCommitName' => 'text255', 19 + 'description' => 'text', 20 + ), 21 + array( 22 + 'PRIMARY' => array( 23 + 'columns' => array('fullCommitName'), 24 + 'unique' => true, 25 + ), 26 + )); 27 + 28 + $this->buildRawSchema( 29 + id(new PhabricatorRepository())->getApplicationName(), 30 + PhabricatorRepository::TABLE_COVERAGE, 31 + array( 32 + 'id' => 'id', 33 + 'branchID' => 'id', 34 + 'commitID' => 'id', 35 + 'pathID' => 'id', 36 + 'coverage' => 'bytes', 37 + ), 38 + array( 39 + 'PRIMARY' => array( 40 + 'columns' => array('id'), 41 + 'unique' => true, 42 + ), 43 + 'key_path' => array( 44 + 'columns' => array('branchID', 'pathID', 'commitID'), 45 + ), 46 + )); 47 + 48 + $this->buildRawSchema( 49 + id(new PhabricatorRepository())->getApplicationName(), 50 + PhabricatorRepository::TABLE_FILESYSTEM, 51 + array( 52 + 'repositoryID' => 'id', 53 + 'parentID' => 'id', 54 + 'svnCommit' => 'uint32', 55 + 'pathID' => 'id', 56 + 'existed' => 'bool', 57 + 'fileType' => 'uint32', 58 + ), 59 + array( 60 + 'PRIMARY' => array( 61 + 'columns' => array('repositoryID', 'parentID', 'pathID', 'svnCommit'), 62 + 'unique' => true, 63 + ), 64 + 'repositoryID' => array( 65 + 'columns' => array('repositoryID', 'svnCommit'), 66 + ), 67 + )); 68 + 69 + $this->buildRawSchema( 70 + id(new PhabricatorRepository())->getApplicationName(), 71 + PhabricatorRepository::TABLE_LINTMESSAGE, 72 + array( 73 + 'id' => 'id', 74 + 'branchID' => 'id', 75 + 'path' => 'text', 76 + 'line' => 'uint32', 77 + 'authorPHID' => 'phid?', 78 + 'code' => 'text32', 79 + 'severity' => 'text16', 80 + 'name' => 'text255', 81 + 'description' => 'text', 82 + ), 83 + array( 84 + 'PRIMARY' => array( 85 + 'columns' => array('id'), 86 + 'unique' => true, 87 + ), 88 + 'branchID' => array( 89 + 'columns' => array('branchID', 'path(64)'), 90 + ), 91 + 'branchID_2' => array( 92 + 'columns' => array('branchID', 'code', 'path(64)'), 93 + ), 94 + 'key_author' => array( 95 + 'columns' => array('authorPHID'), 96 + ), 97 + )); 98 + 99 + $this->buildRawSchema( 100 + id(new PhabricatorRepository())->getApplicationName(), 101 + PhabricatorRepository::TABLE_PARENTS, 102 + array( 103 + 'id' => 'id', 104 + 'childCommitID' => 'id', 105 + 'parentCommitID' => 'id', 106 + ), 107 + array( 108 + 'PRIMARY' => array( 109 + 'columns' => array('id'), 110 + 'unique' => true, 111 + ), 112 + 'key_child' => array( 113 + 'columns' => array('childCommitID', 'parentCommitID'), 114 + 'unique' => true, 115 + ), 116 + 'key_parent' => array( 117 + 'columns' => array('parentCommitID'), 118 + ), 119 + )); 120 + 121 + $this->buildRawSchema( 122 + id(new PhabricatorRepository())->getApplicationName(), 123 + PhabricatorRepository::TABLE_PATH, 124 + array( 125 + 'id' => 'id', 126 + 'path' => 'text', 127 + 'pathHash' => 'bytes32', 128 + ), 129 + array( 130 + 'PRIMARY' => array( 131 + 'columns' => array('id'), 132 + 'unique' => true, 133 + ), 134 + 'pathHash' => array( 135 + 'columns' => array('pathHash'), 136 + 'unique' => true, 137 + ), 138 + )); 139 + 140 + $this->buildRawSchema( 141 + id(new PhabricatorRepository())->getApplicationName(), 142 + PhabricatorRepository::TABLE_PATHCHANGE, 143 + array( 144 + 'repositoryID' => 'id', 145 + 'pathID' => 'id', 146 + 'commitID' => 'id', 147 + 'targetPathID' => 'id?', 148 + 'targetCommitID' => 'id?', 149 + 'changeType' => 'uint32', 150 + 'fileType' => 'uint32', 151 + 'isDirect' => 'bool', 152 + 'commitSequence' => 'uint32', 153 + ), 154 + array( 155 + 'PRIMARY' => array( 156 + 'columns' => array('commitID', 'pathID'), 157 + 'unique' => true, 158 + ), 159 + 'repositoryID' => array( 160 + 'columns' => array('repositoryID', 'pathID', 'commitSequence'), 161 + ), 162 + )); 163 + 164 + $this->buildRawSchema( 165 + id(new PhabricatorRepository())->getApplicationName(), 166 + PhabricatorRepository::TABLE_SUMMARY, 167 + array( 168 + 'repositoryID' => 'id', 169 + 'size' => 'uint32', 170 + 'lastCommitID' => 'id', 171 + 'epoch' => 'epoch?', 172 + ), 173 + array( 174 + 'PRIMARY' => array( 175 + 'columns' => array('repositoryID'), 176 + 'unique' => true, 177 + ), 178 + 'key_epoch' => array( 179 + 'columns' => array('epoch'), 180 + ), 181 + )); 182 + 183 + } 184 + 185 + }
+10
src/applications/repository/storage/PhabricatorRepositoryStatusMessage.php
··· 23 23 self::CONFIG_SERIALIZATION => array( 24 24 'parameters' => self::SERIALIZATION_JSON, 25 25 ), 26 + self::CONFIG_COLUMN_SCHEMA => array( 27 + 'statusType' => 'text32', 28 + 'statusCode' => 'text32', 29 + ), 30 + self::CONFIG_KEY_SCHEMA => array( 31 + 'repositoryID' => array( 32 + 'columns' => array('repositoryID', 'statusType'), 33 + 'unique' => true, 34 + ), 35 + ), 26 36 ) + parent::getConfiguration(); 27 37 } 28 38
+14
src/applications/repository/storage/PhabricatorRepositorySymbol.php
··· 24 24 return array( 25 25 self::CONFIG_IDS => self::IDS_MANUAL, 26 26 self::CONFIG_TIMESTAMPS => false, 27 + self::CONFIG_COLUMN_SCHEMA => array( 28 + 'id' => null, 29 + 'symbolContext' => 'text128', 30 + 'symbolName' => 'text128', 31 + 'symbolType' => 'text12', 32 + 'symbolLanguage' => 'text32', 33 + 'lineNumber' => 'uint32', 34 + ), 35 + self::CONFIG_KEY_SCHEMA => array( 36 + 'PRIMARY' => null, 37 + 'symbolName' => array( 38 + 'columns' => array('symbolName'), 39 + ), 40 + ), 27 41 ) + parent::getConfiguration(); 28 42 } 29 43
+14
src/applications/repository/storage/PhabricatorRepositoryVCSPassword.php
··· 6 6 protected $userPHID; 7 7 protected $passwordHash; 8 8 9 + public function getConfiguration() { 10 + return array( 11 + self::CONFIG_COLUMN_SCHEMA => array( 12 + 'passwordHash' => 'text128', 13 + ), 14 + self::CONFIG_KEY_SCHEMA => array( 15 + 'key_phid' => array( 16 + 'columns' => array('userPHID'), 17 + 'unique' => true, 18 + ), 19 + ), 20 + ) + parent::getConfiguration(); 21 + } 22 + 9 23 public function setPassword( 10 24 PhutilOpaqueEnvelope $password, 11 25 PhabricatorUser $user) {