Skip to content

A free open source IT asset/license management system

Check if db_column foield already exists

snipef254958db9ff
diff --git a/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php b/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
index 5e8379bdad..7f84bc2eb9 100644
--- a/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
+++ b/database/migrations/2017_01_25_063357_fix_utf8_custom_field_column_names.php
@@ -52,10 +52,12 @@ class FixUtf8CustomFieldColumnNames extends Migration
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
- Schema::table('custom_fields', function ($table) {
- $table->string('db_column')->nullable();
- $table->text('help_text')->nullable();
- });
+ if (!Schema::hasColumn('custom_fields', 'db_column')) {
+ Schema::table('custom_fields', function ($table) {
+ $table->string('db_column')->nullable();
+ $table->text('help_text')->nullable();
+ });
+ }
foreach(CustomField::all() as $field) {