<?php

/**
 * Migration 048 – Add asset minification setting
 */

use App\Database\Migration;

class AddAssetMinificationSetting extends Migration
{
    public function up(): void
    {
        $exists = $this->db->fetch("SELECT 1 FROM iw_settings WHERE setting_key = 'asset_minification_enabled'");
        if (!$exists) {
            $this->db->insert('iw_settings', [
                'setting_key'   => 'asset_minification_enabled',
                'setting_value' => '0',
                'setting_group' => 'performance',
            ]);
        }
    }

    public function down(): void
    {
        $this->db->query("DELETE FROM iw_settings WHERE setting_key = 'asset_minification_enabled'");
    }
}
