Initial commit: Laravel GPS API scaffolding
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user