Add phase_id to inspection_templates to allow templates per phase (optional)

This commit is contained in:
2026-05-11 14:00:21 +02:00
parent 8662e092df
commit ca74a0c2e2
@@ -0,0 +1,30 @@
<?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::table('inspection_templates', function (Blueprint $table) {
$table->foreignId('phase_id')->nullable()->constrained('phases')->onDelete('set null');
$table->index('phase_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('inspection_templates', function (Blueprint $table) {
$table->dropForeign(['phase_id']);
$table->dropColumn('phase_id');
});
}
};