1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 12:23:06 +08:00
course-tencent-cloud/db/migrations/20210903040558.php

41 lines
1.0 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
use Phinx\Migration\AbstractMigration;
final class V20210903040558 extends AbstractMigration
{
public function up()
{
$this->handleVodSetting();
}
protected function handleVodSetting()
{
$row = $this->getQueryBuilder()
->select('*')
->from('kg_setting')
->where(['section' => 'vod', 'item_key' => 'video_quality'])
->execute()->fetch(PDO::FETCH_ASSOC);
/**
* 数组索引不连续造成对象序列化后的数据不合乎要求
*/
$itemValue = json_decode($row['item_value'], true);
$itemValue = array_values($itemValue);
$itemValue = json_encode($itemValue);
$this->getQueryBuilder()
->update('kg_setting')
->set('item_value', $itemValue)
->where(['id' => $row['id']])
->execute();
}
}