Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130921.xmigratemaniphest.php
| <?php | <?php | ||||
| $task_table = new ManiphestTask(); | $task_table = new ManiphestTask(); | ||||
| $conn_w = $task_table->establishConnection('w'); | $conn_w = $task_table->establishConnection('w'); | ||||
| $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_transaction'); | $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_transaction'); | ||||
| $conn_w->openTransaction(); | $conn_w->openTransaction(); | ||||
| // NOTE: These were the correct table names at the time of this patch. | // NOTE: These were the correct table names at the time of this patch. | ||||
| $xaction_table_name = 'maniphest_transactionpro'; | $xaction_table_name = 'maniphest_transactionpro'; | ||||
| $comment_table_name = 'maniphest_transaction_comment'; | $comment_table_name = 'maniphest_transaction_comment'; | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $row_id = $row['id']; | $row_id = $row['id']; | ||||
| $task_id = $row['taskID']; | $task_id = $row['taskID']; | ||||
| echo "Migrating row {$row_id} (T{$task_id})...\n"; | echo pht('Migrating row %d (%s)...', $row_id, "T{$task_id}")."\n"; | ||||
| $task_row = queryfx_one( | $task_row = queryfx_one( | ||||
| $conn_w, | $conn_w, | ||||
| 'SELECT phid FROM %T WHERE id = %d', | 'SELECT phid FROM %T WHERE id = %d', | ||||
| $task_table->getTableName(), | $task_table->getTableName(), | ||||
| $task_id); | $task_id); | ||||
| if (!$task_row) { | if (!$task_row) { | ||||
| echo "Skipping, no such task.\n"; | echo pht('Skipping, no such task.')."\n"; | ||||
| continue; | continue; | ||||
| } | } | ||||
| $task_phid = $task_row['phid']; | $task_phid = $task_row['phid']; | ||||
| $has_comment = strlen(trim($row['comments'])); | $has_comment = strlen(trim($row['comments'])); | ||||
| $xaction_type = $row['transactionType']; | $xaction_type = $row['transactionType']; | ||||
| ▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | queryfx( | ||||
| $xaction_source, | $xaction_source, | ||||
| $xaction_meta, | $xaction_meta, | ||||
| $row['dateCreated'], | $row['dateCreated'], | ||||
| $row['dateModified']); | $row['dateModified']); | ||||
| } | } | ||||
| } | } | ||||
| $conn_w->saveTransaction(); | $conn_w->saveTransaction(); | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||