diff --git a/Migrations/2026_03_24_000000_cascade_delete_namespaces_on_workspace_delete.php b/Migrations/2026_03_24_000000_cascade_delete_namespaces_on_workspace_delete.php new file mode 100644 index 0000000..bb5f6a5 --- /dev/null +++ b/Migrations/2026_03_24_000000_cascade_delete_namespaces_on_workspace_delete.php @@ -0,0 +1,40 @@ +dropForeign(['workspace_id']); + + $table->foreign('workspace_id') + ->references('id') + ->on('workspaces') + ->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::table('namespaces', function (Blueprint $table) { + $table->dropForeign(['workspace_id']); + + $table->foreign('workspace_id') + ->references('id') + ->on('workspaces') + ->nullOnDelete(); + }); + } +};