Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15387734
D19182.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D19182.diff
View Options
diff --git a/resources/sql/autopatches/20180306.opath.03.purge.php b/resources/sql/autopatches/20180306.opath.03.purge.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180306.opath.03.purge.php
@@ -0,0 +1,22 @@
+<?php
+
+$table = new PhabricatorOwnersPath();
+$conn = $table->establishConnection('w');
+
+$seen = array();
+foreach (new LiskMigrationIterator($table) as $path) {
+ $package_id = $path->getPackageID();
+ $repository_phid = $path->getRepositoryPHID();
+ $path_index = $path->getPathIndex();
+
+ if (!isset($seen[$package_id][$repository_phid][$path_index])) {
+ $seen[$package_id][$repository_phid][$path_index] = true;
+ continue;
+ }
+
+ queryfx(
+ $conn,
+ 'DELETE FROM %T WHERE id = %d',
+ $table->getTableName(),
+ $path->getID());
+}
diff --git a/resources/sql/autopatches/20180306.opath.04.unique.sql b/resources/sql/autopatches/20180306.opath.04.unique.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180306.opath.04.unique.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_owners.owners_path
+ ADD UNIQUE KEY `key_path` (packageID, repositoryPHID, pathIndex);
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
@@ -20,8 +20,9 @@
'excluded' => 'bool',
),
self::CONFIG_KEY_SCHEMA => array(
- 'packageID' => array(
- 'columns' => array('packageID'),
+ 'key_path' => array(
+ 'columns' => array('packageID', 'repositoryPHID', 'pathIndex'),
+ 'unique' => true,
),
),
) + parent::getConfiguration();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 2:49 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7302416
Default Alt Text
D19182.diff (1 KB)
Attached To
Mode
D19182: Add a unique key to OwnersPath on "<packageID, repositoryPHID, pathIndex>"
Attached
Detach File
Event Timeline
Log In to Comment