fetchAll("SELECT id, settings FROM slides WHERE type = 'qa'"); foreach ($rows as $row) { $settings = json_decode((string)$row['settings'], true); if (!is_array($settings) || !array_key_exists('max_upvotes', $settings)) { continue; } $settings['upvote_share'] = (int)$settings['max_upvotes'] === 0 ? 0 : 25; unset($settings['max_upvotes']); $this->getAdapter()->execute( 'UPDATE slides SET settings = ? WHERE id = ?', [json_encode($settings, JSON_UNESCAPED_UNICODE), $row['id']], ); } } /** * @return void */ public function down(): void { } }