<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        DB::table('posts')
            ->where('slug', '!=', 'intelligent-modernisieren')
            ->update([
                'is_featured' => false,
                'is_published' => false,
                'updated_at' => now(),
            ]);

        DB::table('posts')
            ->where('slug', 'intelligent-modernisieren')
            ->update([
                'is_featured' => false,
                'is_published' => true,
                'updated_at' => now(),
            ]);
    }

    public function down(): void
    {
        DB::table('posts')->update([
            'is_published' => true,
            'updated_at' => now(),
        ]);

        DB::table('posts')
            ->where('slug', 'photovoltaik-direktverrechnung-luxemburg')
            ->update([
                'is_featured' => true,
                'updated_at' => now(),
            ]);
    }
};
