1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-27 21:10:24 +08:00
course-tencent-cloud/db/migrations/20210903040558.php
2022-08-19 17:10:30 +08:00

45 lines
1.1 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
require_once 'SettingTrait.php';
use Phinx\Migration\AbstractMigration;
final class V20210903040558 extends AbstractMigration
{
use SettingTrait;
public function up()
{
$this->handleVodSettings();
}
protected function handleVodSettings()
{
$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();
}
}