1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00
phorge-phorge/resources/sql/patches/20130915.maniphestmigrate.php
epriestley bd40e74400 Migrate auxiliary field storage to common field storage
Summary: Ref T418. Moves data from the Maniphest-specific table to the general one. This patch is a bit gross, but mostly about getting the reads and writes aimed correctly. Future patches will clean things up.

Test Plan: Migrated data across formats. Verified it survied the migration. Viewed and edited tasks' custom fields.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T418

Differential Revision: https://secure.phabricator.com/D6999
2013-09-16 16:02:06 -07:00

25 lines
646 B
PHP

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