diff --git a/database/migrations/2024_10_06_105914_add_role_and_status_to_users_table.php b/database/migrations/2024_10_06_105914_add_role_and_status_to_users_table.php new file mode 100644 index 0000000..726f1ba --- /dev/null +++ b/database/migrations/2024_10_06_105914_add_role_and_status_to_users_table.php @@ -0,0 +1,39 @@ +unsignedBigInteger('role_id')->nullable(); + $table->foreign('role_id')->references('id')->on('roles')->onDelete('set null'); + + $table->unsignedBigInteger('status_id')->nullable(); + $table->foreign('status_id')->references('id')->on('statuses')->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropForeign(['role_id']); + $table->dropForeign(['status_id']); + $table->dropColumn(['role_id', 'status_id']); + }); + } +} +