From adde4089b49b71f7761a02c66b43eb807f86747f Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 6 Mar 2018 19:50:09 -0800 Subject: [PATCH] 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 --- resources/sql/autopatches/20180306.opath.05.longpath.sql | 2 ++ resources/sql/autopatches/20180306.opath.06.pathdisplay.sql | 2 ++ resources/sql/autopatches/20180306.opath.07.copypaths.sql | 2 ++ src/applications/owners/storage/PhabricatorOwnersPath.php | 5 ++++- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 resources/sql/autopatches/20180306.opath.05.longpath.sql create mode 100644 resources/sql/autopatches/20180306.opath.06.pathdisplay.sql create mode 100644 resources/sql/autopatches/20180306.opath.07.copypaths.sql diff --git a/resources/sql/autopatches/20180306.opath.05.longpath.sql b/resources/sql/autopatches/20180306.opath.05.longpath.sql new file mode 100644 index 0000000000..79ff2f7a7f --- /dev/null +++ b/resources/sql/autopatches/20180306.opath.05.longpath.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_owners.owners_path + CHANGE path path LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20180306.opath.06.pathdisplay.sql b/resources/sql/autopatches/20180306.opath.06.pathdisplay.sql new file mode 100644 index 0000000000..b9b336ecd7 --- /dev/null +++ b/resources/sql/autopatches/20180306.opath.06.pathdisplay.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_owners.owners_path + ADD pathDisplay LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT}; diff --git a/resources/sql/autopatches/20180306.opath.07.copypaths.sql b/resources/sql/autopatches/20180306.opath.07.copypaths.sql new file mode 100644 index 0000000000..74ebecfa9a --- /dev/null +++ b/resources/sql/autopatches/20180306.opath.07.copypaths.sql @@ -0,0 +1,2 @@ +UPDATE {$NAMESPACE}_owners.owners_path + SET pathDisplay = path WHERE pathDisplay = ''; diff --git a/src/applications/owners/storage/PhabricatorOwnersPath.php b/src/applications/owners/storage/PhabricatorOwnersPath.php index 7e7822df1a..6c49023e69 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPath.php +++ b/src/applications/owners/storage/PhabricatorOwnersPath.php @@ -6,6 +6,7 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO { protected $repositoryPHID; protected $pathIndex; protected $path; + protected $pathDisplay; protected $excluded; private $fragments; @@ -15,7 +16,8 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO { return array( self::CONFIG_TIMESTAMPS => false, self::CONFIG_COLUMN_SCHEMA => array( - 'path' => 'text255', + 'path' => 'text', + 'pathDisplay' => 'text', 'pathIndex' => 'bytes12', 'excluded' => 'bool', ), @@ -36,6 +38,7 @@ final class PhabricatorOwnersPath extends PhabricatorOwnersDAO { $path->pathIndex = PhabricatorHash::digestForIndex($raw_path); $path->path = $raw_path; + $path->pathDisplay = $raw_path; $path->excluded = $ref['excluded'];