Initial: Laravel 13 setup with multi-tenant schema

This commit is contained in:
Jan (Plesk) 2026-04-20 00:34:21 +02:00
commit a78a50ef0c
69 changed files with 10805 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<?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 $t) {
$t->id();
$t->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete();
$t->string('name',100);
$t->string('slug',50);
$t->string('type',30)->default('ems-esp');
$t->string('mqtt_topic_prefix',100);
$t->string('mqtt_username',50)->nullable();
$t->string('timezone',50)->default('Europe/Berlin');
$t->json('settings')->nullable();
$t->timestamp('last_seen_at')->nullable();
$t->timestamps();
$t->unique(['tenant_id','slug']);
$t->index('tenant_id');
});
}
public function down(): void { Schema::dropIfExists('devices'); }
};