Skip to content

A free open source IT asset/license management system

One more fix for MAC address weirdness

snipea590cc3dd27c
diff --git a/database/migrations/2016_07_22_054850_one_more_mac_addr_fix.php b/database/migrations/2016_07_22_054850_one_more_mac_addr_fix.php
new file mode 100644
index 0000000000..cc45976d54
--- /dev/null
+++ b/database/migrations/2016_07_22_054850_one_more_mac_addr_fix.php
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class OneMoreMacAddrFix extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ foreach(\App\Models\CustomField::all() as $custom_field) {
+
+ if ($custom_field->format=='regex:/^MAC$/') {
+ $custom_field->format = 'regex:/^[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}:[a-fA-F0-9]{2}$/';
+ }
+ $custom_field->save();
+
+ }
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ //
+ }
+}