3 // Migrate saved Differential revision queries from using a "<select />"
4 // control with hard-coded status groups for status selection to using a
5 // tokenizer with status functions.
7 $table = new PhabricatorSavedQuery();
8 $conn = $table->establishConnection('w');
11 'status-open' => array('open()'),
12 'status-closed' => array('closed()'),
14 'status-accepted' => array('accepted'),
15 'status-needs-review' => array('needs-review'),
16 'status-needs-revision' => array('needs-revision'),
17 'status-abandoned' => array('abandoned'),
20 foreach (new LiskMigrationIterator($table) as $query) {
21 if ($query->getEngineClassName() !== 'DifferentialRevisionSearchEngine') {
22 // This isn't a revision query.
26 $parameters = $query->getParameters();
27 $status = idx($parameters, 'status');
30 // This query didn't specify a "status" value.
34 if (!isset($status_map[$status])) {
35 // The "status" value is unknown, or does not correspond to a
36 // modern "status" constraint.
40 $parameters['statuses'] = $status_map[$status];
44 'UPDATE %T SET parameters = %s WHERE id = %d',
45 $table->getTableName(),
46 phutil_json_encode($parameters),