1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-30 16:38:21 +01:00

Allow owners paths to be arbitrarily long and add storage for display paths

Summary:
Depends on D19182. Ref T11015. This changes `path` from `text255` to `longtext` because paths may be arbitrarily long.

It adds `pathDisplay` to prepare for display paths and storage paths having different values. For now, `pathDisplay` is copied from `path` and always has the same value.

Test Plan:
  - Ran migration, checked database for sanity (all `pathDisplay` and `path` values identical).
  - Added new paths, saw `pathDisplay` and `path` get the same values.
  - Added an unreasonably enormous path with far more than 255 characters.

Maniphest Tasks: T11015

Differential Revision: https://secure.phabricator.com/D19183
This commit is contained in:
epriestley 2018-03-06 19:50:09 -08:00
parent 8cb273a053
commit adde4089b4
4 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_owners.owners_path
CHANGE path path LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
ALTER TABLE {$NAMESPACE}_owners.owners_path
ADD pathDisplay LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};

View file

@ -0,0 +1,2 @@
UPDATE {$NAMESPACE}_owners.owners_path
SET pathDisplay = path WHERE pathDisplay = '';

View file

@ -6,6 +6,7 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO {
protected $repositoryPHID; protected $repositoryPHID;
protected $pathIndex; protected $pathIndex;
protected $path; protected $path;
protected $pathDisplay;
protected $excluded; protected $excluded;
private $fragments; private $fragments;
@ -15,7 +16,8 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO {
return array( return array(
self::CONFIG_TIMESTAMPS => false, self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array( self::CONFIG_COLUMN_SCHEMA => array(
'path' => 'text255', 'path' => 'text',
'pathDisplay' => 'text',
'pathIndex' => 'bytes12', 'pathIndex' => 'bytes12',
'excluded' => 'bool', 'excluded' => 'bool',
), ),
@ -36,6 +38,7 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO {
$path->pathIndex = PhabricatorHash::digestForIndex($raw_path); $path->pathIndex = PhabricatorHash::digestForIndex($raw_path);
$path->path = $raw_path; $path->path = $raw_path;
$path->pathDisplay = $raw_path;
$path->excluded = $ref['excluded']; $path->excluded = $ref['excluded'];