diff --git a/database/migrations/2015_09_22_003413_migrate_mac_address.php b/database/migrations/2015_09_22_003413_migrate_mac_address.php index 8167e28adf..3c4bf93e15 100644 --- a/database/migrations/2015_09_22_003413_migrate_mac_address.php +++ b/database/migrations/2015_09_22_003413_migrate_mac_address.php @@ -48,13 +48,19 @@ class MigrateMacAddress extends Migration */ public function down() { - // $f = \App\Models\CustomFieldset::where(['name' => 'Asset with MAC Address'])->first(); - $f->fields()->delete(); - $f->delete(); + + if ($f) { + $f->fields()->delete(); + $f->delete(); + } + Schema::table('models', function (Blueprint $table) { $table->renameColumn('deprecated_mac_address', 'show_mac_address'); }); - DB::statement('ALTER TABLE assets CHANGE _snipeit_mac_address_1 mac_address varchar(255)'); + + if (Schema::hasColumn('assets', '_snipeit_mac_address')) { + DB::statement('ALTER TABLE assets CHANGE _snipeit_mac_address mac_address varchar(255)'); + } } }