From dda13bd6a52750e0ede78ebe80b7028a34dac58e Mon Sep 17 00:00:00 2001 From: ziming Date: Sun, 24 Mar 2024 13:24:41 +0800 Subject: [PATCH] add foreign key to user_id --- database/migrations/create_filament_comments_table.php.stub | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/database/migrations/create_filament_comments_table.php.stub b/database/migrations/create_filament_comments_table.php.stub index 671c374..10e350c 100644 --- a/database/migrations/create_filament_comments_table.php.stub +++ b/database/migrations/create_filament_comments_table.php.stub @@ -16,6 +16,12 @@ return new class extends Migration $table->longText('comment'); $table->timestamps(); $table->softDeletes(); + + $table->foreign('user_id') + ->references('id') + ->on('users') + ->cascadeOnUpdate() + ->cascadeOnDelete(); }); }