/
Update_498.php
23 lines (21 loc) · 973 Bytes
/
Update_498.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
namespace LimeSurvey\Helpers\Update;
/**
* Some of it is a copy of update 453 which has been skipped on some installations
*/
class Update_498 extends DatabaseUpdateBase
{
public function up()
{
$columnSchema = $this->db->getSchema()->getTable('{{archived_table_settings}}')->getColumn('attributes');
if ($columnSchema === null) {
$this->db->createCommand()->addColumn('{{archived_table_settings}}', 'attributes', 'text NULL');
$archivedTableSettings = \Yii::app()->db->createCommand("SELECT * FROM {{archived_table_settings}}")->queryAll();
foreach ($archivedTableSettings as $archivedTableSetting) {
if ($archivedTableSetting['tbl_type'] === 'token') {
$this->db->createCommand()->update('{{archived_table_settings}}', ['attributes' => json_encode(['unknown'])], 'id = :id', ['id' => $archivedTableSetting['id']]);
}
}
}
}
}