38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?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::create('waypoints', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('sales_route_id')->constrained()->cascadeOnDelete();
|
|
$table->enum('type', ['checkin', 'checkout', 'gps', 'lunch', 'visit']);
|
|
$table->decimal('latitude', 10, 8);
|
|
$table->decimal('longitude', 11, 8);
|
|
$table->timestamp('recorded_at');
|
|
$table->string('location_name', 200)->nullable();
|
|
$table->text('address')->nullable();
|
|
$table->text('notes')->nullable();
|
|
$table->string('photo_url', 500)->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['sales_route_id', 'recorded_at']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('waypoints');
|
|
}
|
|
};
|