Initial: Laravel 13 setup with multi-tenant schema
This commit is contained in:
commit
a78a50ef0c
69 changed files with 10805 additions and 0 deletions
|
|
@ -0,0 +1,19 @@
|
|||
<?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('readings', function (Blueprint $t) {
|
||||
$t->bigIncrements('id');
|
||||
$t->foreignId('device_id')->constrained('devices')->cascadeOnDelete();
|
||||
$t->string('metric',60);
|
||||
$t->decimal('value',10,3)->nullable();
|
||||
$t->string('value_text',50)->nullable();
|
||||
$t->timestamp('recorded_at',3);
|
||||
$t->index(['device_id','metric','recorded_at'],'idx_dmt');
|
||||
$t->index('recorded_at','idx_rec');
|
||||
});
|
||||
}
|
||||
public function down(): void { Schema::dropIfExists('readings'); }
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue