diff --git a/database/migrations/2020_10_22_233743_move_accessory_checkout_note_to_join_table.php b/database/migrations/2020_10_22_233743_move_accessory_checkout_note_to_join_table.php index bfa9a7e362..d2e087d9bd 100644 --- a/database/migrations/2020_10_22_233743_move_accessory_checkout_note_to_join_table.php +++ b/database/migrations/2020_10_22_233743_move_accessory_checkout_note_to_join_table.php @@ -15,9 +15,16 @@ class MoveAccessoryCheckoutNoteToJoinTable extends Migration */ public function up() { - Schema::table('accessories_users', function (Blueprint $table) { - $table->string('note')->nullable(true)->default(null); - }); + + if (!Schema::hasColumn('accessories_users', 'note')) + { + Schema::table('accessories_users', function (Blueprint $table) { + $table->string('note')->nullable(true)->default(null); + }); + } + + + // Loop through the checked out accessories, find their related action_log entry, and copy over the note // to the newly created note field @@ -82,8 +89,15 @@ class MoveAccessoryCheckoutNoteToJoinTable extends Migration */ public function down() { - Schema::table('accessories_users', function (Blueprint $table) { - $table->dropColumn('note'); - }); + + if (Schema::hasColumn('accessories_users', 'note')) + { + Schema::table('accessories_users', function (Blueprint $table) + { + $table->dropColumn('note'); + }); + } + + } }