Fix deleting node with database host

* fix: delete database host when node is deleted

* chore: revert change to file
This commit is contained in:
Scai 2024-12-27 23:12:49 +02:00 committed by GitHub
parent 00644c2c60
commit f684da997c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,28 @@
<?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('database_host_node', function (Blueprint $table) {
$table->dropForeign(['node_id']);
$table->foreign('node_id')->references('id')->on('nodes')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};