diff --git a/database/migrations/2024_04_17_085132_add_foreign_key_to_students.php b/database/migrations/2024_04_17_085132_add_foreign_key_to_students.php index 6670723..4383eac 100644 --- a/database/migrations/2024_04_17_085132_add_foreign_key_to_students.php +++ b/database/migrations/2024_04_17_085132_add_foreign_key_to_students.php @@ -12,7 +12,7 @@ return new class extends Migration public function up(): void { Schema::table('students', function (Blueprint $table) { - $table->foreignId('grade_id')->constrained('grades'); + $table->foreignId('grade_id')->constrained('grades')->onDelete('cascade'); }); }