Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130915.maniphestmigrate.php
| <?php | <?php | ||||
| $conn_w = id(new ManiphestTask())->establishConnection('w'); | $conn_w = id(new ManiphestTask())->establishConnection('w'); | ||||
| $table_name = id(new ManiphestCustomFieldStorage())->getTableName(); | $table_name = id(new ManiphestCustomFieldStorage())->getTableName(); | ||||
| $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_taskauxiliarystorage'); | $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_taskauxiliarystorage'); | ||||
| echo "Migrating custom storage for Maniphest fields...\n"; | echo pht('Migrating custom storage for Maniphest fields...')."\n"; | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $phid = $row['taskPHID']; | $phid = $row['taskPHID']; | ||||
| $name = $row['name']; | $name = $row['name']; | ||||
| echo "Migrating {$phid} / {$name}...\n"; | echo pht('Migrating %s / %s...', $phid, $name)."\n"; | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue) | 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue) | ||||
| VALUES (%s, %s, %s)', | VALUES (%s, %s, %s)', | ||||
| $table_name, | $table_name, | ||||
| $phid, | $phid, | ||||
| PhabricatorHash::digestForIndex('std:maniphest:'.$name), | PhabricatorHash::digestForIndex('std:maniphest:'.$name), | ||||
| $row['value']); | $row['value']); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||