This commit is contained in:
Simon Pocrnjič
2025-09-28 00:30:18 +02:00
parent 7227c888d4
commit a913cfc381
44 changed files with 2123 additions and 587 deletions
@@ -0,0 +1,42 @@
<?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::dropIfExists('objects');
Schema::dropIfExists('object_types');
Schema::create('objects', function (Blueprint $table) {
$table->id();
$table->string('reference', 125)->nullable();
$table->string('name', 255);
$table->string('description', 255)->nullable();
$table->string('type', 125)->nullable();
$table->foreignId('contract_id')->constrained('contracts')->cascadeOnDelete();
// Indexes for faster lookups
$table->softDeletes();
$table->timestamps();
$table->index('type');
$table->index('reference');
$table->index('contract_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('objects');
Schema::dropIfExists('object_types');
}
};