<?php

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

return new class extends Migration {
    public function up(): void
    {
        Schema::table('devices', function (Blueprint $table) {
            $table->decimal('latitude',  10, 6)->nullable()->after('location');
            $table->decimal('longitude', 10, 6)->nullable()->after('latitude');
            $table->string('highway')->nullable()->after('longitude');  // e.g. "LDP Northbound"
            $table->string('chainage')->nullable()->after('highway');   // e.g. "KM8.1"
        });
    }

    public function down(): void
    {
        Schema::table('devices', function (Blueprint $table) {
            $table->dropColumn(['latitude', 'longitude', 'highway', 'chainage']);
        });
    }
};
