mirror of
https://we.phorge.it/source/phorge.git
synced 2024-10-19 15:18:51 +02:00
31 lines
640 B
PHP
31 lines
640 B
PHP
|
<?php
|
||
|
|
||
|
// Previously, Almanac services stored a "serviceClass". Migrate these to
|
||
|
// new "serviceType" values.
|
||
|
|
||
|
$table = new AlmanacService();
|
||
|
$conn_w = $table->establishConnection('w');
|
||
|
|
||
|
foreach (new LiskMigrationIterator($table) as $service) {
|
||
|
|
||
|
$new_type = null;
|
||
|
try {
|
||
|
$old_type = $service->getServiceType();
|
||
|
$object = newv($old_type, array());
|
||
|
$new_type = $object->getServiceTypeConstant();
|
||
|
} catch (Exception $ex) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
if (!$new_type) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
queryfx(
|
||
|
$conn_w,
|
||
|
'UPDATE %T SET serviceType = %s WHERE id = %d',
|
||
|
$table->getTableName(),
|
||
|
$new_type,
|
||
|
$service->getID());
|
||
|
}
|