Daniel Supernault пре 1 година
родитељ
комит
ef57d471e5
1 измењених фајлова са 11 додато и 3 уклоњено
  1. 11 3
      database/migrations/2023_12_27_082024_add_has_roles_to_users_table.php

+ 11 - 3
database/migrations/2023_12_27_082024_add_has_roles_to_users_table.php

@@ -24,9 +24,17 @@ return new class extends Migration
     public function down(): void
     {
         Schema::table('users', function (Blueprint $table) {
-            $table->dropColumn('has_roles');
-            $table->dropColumn('parent_id');
-            $table->dropColumn('role_id');
+            if (Schema::hasColumn('users', 'has_roles')) {
+                $table->dropColumn('has_roles');
+            }
+
+            if (Schema::hasColumn('users', 'role_id')) {
+                $table->dropColumn('role_id');
+            }
+
+            if (Schema::hasColumn('users', 'parent_id')) {
+                $table->dropColumn('parent_id');
+            }
         });
     }
 };