@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.

Update table schema for "AffectedPath" table

Summary:
Ref T13639. Make schema changes:

- Make repositoryID nullable, for revisions with no repository.
- Remove "epoch", which has no readers and no clear use.
- Change the ordering of the key, since "pathID" has more unique values and no queries ever issue without it.

Test Plan:
- Ran `bin/storage upgrade`, got a clean schema.
- Reindexed all revisions with an external script.
- Reviewed index via debug UI, saw appropriate index for non-repositoy revisions.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13639

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

+11 -8
+2
resources/sql/autopatches/20210315.affectedpath.01.epoch.sql
··· 1 + ALTER TABLE {$NAMESPACE}_differential.differential_affectedpath 2 + DROP epoch;
+2
resources/sql/autopatches/20210315.affectedpath.02.repositoryid.sql
··· 1 + ALTER TABLE {$NAMESPACE}_differential.differential_affectedpath 2 + CHANGE repositoryID repositoryID INT UNSIGNED;
+3 -4
src/applications/differential/engine/DifferentialAffectedPathEngine.php
··· 32 32 if ($repository) { 33 33 $repository_id = $repository->getID(); 34 34 } else { 35 - return; 35 + $repository_id = null; 36 36 } 37 37 38 38 $paths = $this->getAffectedPaths(); ··· 48 48 foreach ($path_ids as $path_id) { 49 49 $sql[] = qsprintf( 50 50 $conn, 51 - '(%d, %d, %d, %d)', 51 + '(%nd, %d, %d)', 52 52 $repository_id, 53 53 $path_id, 54 - PhabricatorTime::getNow(), 55 54 $revision->getID()); 56 55 } 57 56 ··· 64 63 foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { 65 64 queryfx( 66 65 $conn, 67 - 'INSERT INTO %R (repositoryID, pathID, epoch, revisionID) VALUES %LQ', 66 + 'INSERT INTO %R (repositoryID, pathID, revisionID) VALUES %LQ', 68 67 $table, 69 68 $chunk); 70 69 }
+4 -4
src/applications/differential/storage/DifferentialAffectedPath.php
··· 8 8 9 9 protected $repositoryID; 10 10 protected $pathID; 11 - protected $epoch; 12 11 protected $revisionID; 13 12 14 13 protected function getConfiguration() { ··· 16 15 self::CONFIG_TIMESTAMPS => false, 17 16 self::CONFIG_COLUMN_SCHEMA => array( 18 17 'id' => null, 18 + 'repositoryID' => 'id?', 19 19 ), 20 20 self::CONFIG_KEY_SCHEMA => array( 21 21 'PRIMARY' => null, 22 - 'repositoryID' => array( 23 - 'columns' => array('repositoryID', 'pathID', 'epoch'), 24 - ), 25 22 'revisionID' => array( 26 23 'columns' => array('revisionID'), 24 + ), 25 + 'key_path' => array( 26 + 'columns' => array('pathID', 'repositoryID'), 27 27 ), 28 28 ), 29 29 ) + parent::getConfiguration();