<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('road_patrols', function (Blueprint $table) {
            $table->double('start_lat', null, 0)->nullable()->change();
            $table->double('start_lon', null, 0)->nullable()->change();
            $table->double('end_lat', null, 0)->nullable()->change();
            $table->double('end_lon', null, 0)->nullable()->change();
            $table->integer('fuel_consumption')->nullable();
            $table->integer('vehicle_runtime')->nullable();
            $table->json('stop_points')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('road_patrols', function (Blueprint $table) {
            $table->double('start_lat', null, 0)->change();
            $table->double('start_lon', null, 0)->change();
            $table->double('end_lat', null, 0)->change();
            $table->double('end_lon', null, 0)->change();
            $table->dropColumn('fuel_consumption');
            $table->dropColumn('vehicle_runtime');
            $table->dropColumn('stop_points');
        });
    }
};
