Add phase_id to inspection_templates to allow templates per phase (optional)
This commit is contained in:
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user