Laravel-GPS-API/database/migrations/2025_08_29_000001_create_devices_table.php

29 lines
907 B
PHP

<?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('devices', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->nullable()->index();
$table->string('name')->nullable();
$table->string('imei', 32)->unique();
$table->boolean('is_active')->default(true);
$table->timestamp('last_seen_at')->nullable()->index();
$table->string('last_ip')->nullable();
$table->string('firmware_version')->nullable();
$table->string('hardware_version')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('devices');
}
};