Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/patches/20130728.ponderxcomment.php
| Show All 10 Lines | |||||
| $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); | $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); | ||||
| foreach ($rows as $row) { | foreach ($rows as $row) { | ||||
| $id = $row['id']; | $id = $row['id']; | ||||
| echo "Migrating {$id}...\n"; | echo "Migrating {$id}...\n"; | ||||
| $type = phid_get_type($row['targetPHID']); | $type = phid_get_type($row['targetPHID']); | ||||
| switch ($type) { | switch ($type) { | ||||
| case PonderPHIDTypeQuestion::TYPECONST: | case PonderQuestionPHIDType::TYPECONST: | ||||
| $table_obj = $qtable; | $table_obj = $qtable; | ||||
| $comment_obj = new PonderQuestionTransactionComment(); | $comment_obj = new PonderQuestionTransactionComment(); | ||||
| break; | break; | ||||
| case PonderPHIDTypeAnswer::TYPECONST: | case PonderAnswerPHIDType::TYPECONST: | ||||
| $table_obj = $atable; | $table_obj = $atable; | ||||
| $comment_obj = new PonderAnswerTransactionComment(); | $comment_obj = new PonderAnswerTransactionComment(); | ||||
| break; | break; | ||||
| } | } | ||||
| $comment_phid = PhabricatorPHID::generateNewPHID( | $comment_phid = PhabricatorPHID::generateNewPHID( | ||||
| PhabricatorApplicationTransactionPHIDTypeTransaction::TYPECONST, | PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | ||||
| $type); | $type); | ||||
| $xaction_phid = PhabricatorPHID::generateNewPHID( | $xaction_phid = PhabricatorPHID::generateNewPHID( | ||||
| PhabricatorApplicationTransactionPHIDTypeTransaction::TYPECONST, | PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, | ||||
| $type); | $type); | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'INSERT INTO %T (phid, transactionPHID, authorPHID, viewPolicy, editPolicy, | 'INSERT INTO %T (phid, transactionPHID, authorPHID, viewPolicy, editPolicy, | ||||
| commentVersion, content, contentSource, isDeleted, dateCreated, | commentVersion, content, contentSource, isDeleted, dateCreated, | ||||
| dateModified) | dateModified) | ||||
| VALUES (%s, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d)', | VALUES (%s, %s, %s, %s, %s, %d, %s, %s, %d, %d, %d)', | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||