Initial commit: Laravel GPS API scaffolding

This commit is contained in:
2025-08-28 17:51:16 +10:00
commit 4069b09e3b
4 changed files with 130 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?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::create('gps_points', function (Blueprint $table) {
$table->id();
$table->string('device_id', 64)->index();
$table->decimal('lat', 10, 7);
$table->decimal('lng', 10, 7);
$table->decimal('speed', 8, 2)->nullable(); // km/h or m/s
$table->decimal('altitude', 8, 2)->nullable(); // meters
$table->unsignedInteger('heading')->nullable(); // degrees
$table->timestamp('recorded_at')->index(); // when device recorded it
$table->json('meta')->nullable(); // any extra fields
$table->timestamps(); // created_at, updated_at
});
}
public function down(): void
{
Schema::dropIfExists('gps_points');
}
};