Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140325.push.3.groups.php
| <?php | <?php | ||||
| $conn_w = id(new PhabricatorRepository())->establishConnection('w'); | $conn_w = id(new PhabricatorRepository())->establishConnection('w'); | ||||
| echo "Adding transaction log event groups...\n"; | echo pht('Adding transaction log event groups...')."\n"; | ||||
| $logs = queryfx_all( | $logs = queryfx_all( | ||||
| $conn_w, | $conn_w, | ||||
| 'SELECT * FROM %T GROUP BY transactionKey ORDER BY id ASC', | 'SELECT * FROM %T GROUP BY transactionKey ORDER BY id ASC', | ||||
| 'repository_pushlog'); | 'repository_pushlog'); | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $id = $log['id']; | $id = $log['id']; | ||||
| echo "Migrating log {$id}...\n"; | echo pht('Migrating log %d...', $id)."\n"; | ||||
| if ($log['pushEventPHID']) { | if ($log['pushEventPHID']) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $event_phid = id(new PhabricatorRepositoryPushEvent())->generatePHID(); | $event_phid = id(new PhabricatorRepositoryPushEvent())->generatePHID(); | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| Show All 13 Lines | foreach ($logs as $log) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET pushEventPHID = %s WHERE transactionKey = %s', | 'UPDATE %T SET pushEventPHID = %s WHERE transactionKey = %s', | ||||
| 'repository_pushlog', | 'repository_pushlog', | ||||
| $event_phid, | $event_phid, | ||||
| $log['transactionKey']); | $log['transactionKey']); | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||