<?php

namespace Database\Seeders;

use App\Console\Commands\BantaranSungaiResult;
use App\Models\BantaranSungaiModel;
use App\Models\BantaranSungaiResultModel;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class HapusData extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {

        $count = 0;
        $batchSize = 1000; // Ukuran batch
        $limit = 1000;  // Target 1 juta data

        do {
            
            $deleted = BantaranSungaiResultModel::where('uuid','77')
                // ->limit($batchSize)
                ->delete();

            $count += $deleted;

            // Ulangi sampai mencapai target atau tidak ada data lagi
        } while ($deleted > 0 && $count < $limit);

        echo "Total data yang dihapus: $count";
    }
}
