diff --git a/database/migrations/2026_04_16_000000_add_updated_by_to_process_templates_table.php b/database/migrations/2026_04_16_000000_add_updated_by_to_process_templates_table.php index 4587b9f377..ae79c2d8da 100644 --- a/database/migrations/2026_04_16_000000_add_updated_by_to_process_templates_table.php +++ b/database/migrations/2026_04_16_000000_add_updated_by_to_process_templates_table.php @@ -8,10 +8,11 @@ return new class extends Migration { public function up() { - Schema::table('process_templates', function (Blueprint $table) { - $table->unsignedInteger('updated_by')->nullable()->after('user_id'); - $table->foreign('updated_by')->references('id')->on('users')->onDelete('set null'); - }); + if (!Schema::hasColumn('process_templates', 'updated_by')) { + Schema::table('process_templates', function (Blueprint $table) { + $table->unsignedInteger('updated_by')->nullable()->after('user_id'); + }); + } // Seed updated_by with the existing user_id value DB::table('process_templates')->update([ @@ -22,7 +23,6 @@ public function up() public function down() { Schema::table('process_templates', function (Blueprint $table) { - $table->dropForeign(['updated_by']); $table->dropColumn('updated_by'); }); }