Check if db_column foield already exists

This commit is contained in:
snipe 2018-01-17 06:48:14 -08:00
parent 24b356dba4
commit f254958db9

View file

@ -52,10 +52,12 @@ class FixUtf8CustomFieldColumnNames extends Migration
$platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform(); $platform = Schema::getConnection()->getDoctrineSchemaManager()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string'); $platform->registerDoctrineTypeMapping('enum', 'string');
Schema::table('custom_fields', function ($table) { if (!Schema::hasColumn('custom_fields', 'db_column')) {
$table->string('db_column')->nullable(); Schema::table('custom_fields', function ($table) {
$table->text('help_text')->nullable(); $table->string('db_column')->nullable();
}); $table->text('help_text')->nullable();
});
}
foreach(CustomField::all() as $field) { foreach(CustomField::all() as $field) {