<?php

namespace App\Console\Commands;

use App\Models\PbgTask;
use App\Models\PbgTaskDetail;
use App\Models\PbgTaskIndexIntegrations;
use App\Models\PbgTaskPrasarana;
use App\Models\PbgTaskRetributions;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class TruncatePBGTable extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:truncate-pbg-table';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        PbgTask::truncate();
        PbgTaskRetributions::truncate();
        PbgTaskDetail::truncate();
        PbgTaskIndexIntegrations::truncate();
        PbgTaskPrasarana::truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
}
