1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01:00
phorge-phorge/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php
epriestley cd7171ec6e Migrate old AuxiliaryField storage to modern CustomField storage
Summary: Ref T2222. Ref T3886. Differential has a legacy storage table for auxiliary fields; move the data to modern storage.

Test Plan:
  - Ran migration.
  - Verified fields still worked properly afterward (view, edit, etc).

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3886, T2222

Differential Revision: https://secure.phabricator.com/D8355
2014-02-26 16:52:30 -08:00

22 lines
619 B
PHP

<?php
$conn_w = id(new DifferentialRevision())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'differential_auxiliaryfield');
echo "Modernizing Differential auxiliary field storage...\n";
$table_name = id(new DifferentialCustomFieldStorage())->getTableName();
foreach ($rows as $row) {
$id = $row['id'];
echo "Migrating row {$id}...\n";
queryfx(
$conn_w,
'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue)
VALUES (%s, %s, %s)',
$table_name,
$row['revisionPHID'],
PhabricatorHash::digestForIndex($row['name']),
$row['value']);
}
echo "Done.\n";