Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15331768
D18394.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
D18394.diff
View Options
diff --git a/resources/sql/autopatches/20170811.differential.01.status.php b/resources/sql/autopatches/20170811.differential.01.status.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20170811.differential.01.status.php
@@ -0,0 +1,48 @@
+<?php
+
+// Migrate saved Differential revision queries from using a "<select />"
+// control with hard-coded status groups for status selection to using a
+// tokenizer with status functions.
+
+$table = new PhabricatorSavedQuery();
+$conn = $table->establishConnection('w');
+
+$status_map = array(
+ 'status-open' => array('open()'),
+ 'status-closed' => array('closed()'),
+
+ 'status-accepted' => array('accepted'),
+ 'status-needs-review' => array('needs-review'),
+ 'status-needs-revision' => array('needs-revision'),
+ 'status-abandoned' => array('abandoned'),
+);
+
+foreach (new LiskMigrationIterator($table) as $query) {
+ if ($query->getEngineClassName() !== 'DifferentialRevisionSearchEngine') {
+ // This isn't a revision query.
+ continue;
+ }
+
+ $parameters = $query->getParameters();
+ $status = idx($parameters, 'status');
+
+ if (!$status) {
+ // This query didn't specify a "status" value.
+ continue;
+ }
+
+ if (!isset($status_map[$status])) {
+ // The "status" value is unknown, or does not correspond to a
+ // modern "status" constraint.
+ continue;
+ }
+
+ $parameters['statuses'] = $status_map[$status];
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET parameters = %s WHERE id = %d',
+ $table->getTableName(),
+ phutil_json_encode($parameters),
+ $query->getID());
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 8, 1:30 PM (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7382542
Default Alt Text
D18394.diff (1 KB)
Attached To
Mode
D18394: Migrate Differential Revision SavedQueries to the new "statuses" tokenizer
Attached
Detach File
Event Timeline
Log In to Comment