Mager updated

This commit is contained in:
Simon Pocrnjič
2025-09-27 17:45:55 +02:00
parent d17e34941b
commit 7227c888d4
74 changed files with 6339 additions and 342 deletions
@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('object_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('objects', function (Blueprint $table) {
$table->id();
$table->string('reference', 125)->nullable();
$table->string('name', 255);
$table->string('description', 255)->nullable();
// If you keep the column name as 'type_id', specify the table explicitly
$table->foreignId('type_id')->constrained('object_types')->nullOnDelete();
// Indexes for faster lookups
$table->softDeletes();
$table->timestamps();
$table->index('reference');
$table->index('type_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('objects');
Schema::dropIfExists('object_types');
}
};