Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13986052
D19181.id45943.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19181.id45943.diff
View Options
diff --git a/resources/sql/autopatches/20180306.opath.01.digest.sql b/resources/sql/autopatches/20180306.opath.01.digest.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180306.opath.01.digest.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_owners.owners_path
+ ADD pathIndex BINARY(12) NOT NULL;
diff --git a/resources/sql/autopatches/20180306.opath.02.digestpopulate.php b/resources/sql/autopatches/20180306.opath.02.digestpopulate.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180306.opath.02.digestpopulate.php
@@ -0,0 +1,19 @@
+<?php
+
+$table = new PhabricatorOwnersPath();
+$conn = $table->establishConnection('w');
+
+foreach (new LiskMigrationIterator($table) as $path) {
+ $index = PhabricatorHash::digestForIndex($path->getPath());
+
+ if ($index === $path->getPathIndex()) {
+ continue;
+ }
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET pathIndex = %s WHERE id = %d',
+ $table->getTableName(),
+ $index,
+ $path->getID());
+}
diff --git a/src/applications/owners/storage/PhabricatorOwnersPath.php b/src/applications/owners/storage/PhabricatorOwnersPath.php
--- a/src/applications/owners/storage/PhabricatorOwnersPath.php
+++ b/src/applications/owners/storage/PhabricatorOwnersPath.php
@@ -4,6 +4,7 @@
protected $packageID;
protected $repositoryPHID;
+ protected $pathIndex;
protected $path;
protected $excluded;
@@ -15,6 +16,7 @@
self::CONFIG_TIMESTAMPS => false,
self::CONFIG_COLUMN_SCHEMA => array(
'path' => 'text255',
+ 'pathIndex' => 'bytes12',
'excluded' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
@@ -25,12 +27,17 @@
) + parent::getConfiguration();
}
-
public static function newFromRef(array $ref) {
$path = new PhabricatorOwnersPath();
$path->repositoryPHID = $ref['repositoryPHID'];
- $path->path = $ref['path'];
+
+ $raw_path = $ref['path'];
+
+ $path->pathIndex = PhabricatorHash::digestForIndex($raw_path);
+ $path->path = $raw_path;
+
$path->excluded = $ref['excluded'];
+
return $path;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 12:18 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710956
Default Alt Text
D19181.id45943.diff (2 KB)
Attached To
Mode
D19181: Add and populate a `pathIndex` column for OwnersPath
Attached
Detach File
Event Timeline
Log In to Comment