mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Fix custom field seeder to drop old columns
This commit is contained in:
parent
c616041876
commit
f687c8db24
|
@ -1,13 +1,27 @@
|
|||
<?php
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\CustomField;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
|
||||
class CustomFieldSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$columns = DB::getSchemaBuilder()->getColumnListing('assets');
|
||||
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if(strpos($column, '_snipeit_') !== FALSE) {
|
||||
|
||||
Schema::table('assets', function (Blueprint $table) use ($column) {
|
||||
$table->dropColumn($column);
|
||||
});
|
||||
}
|
||||
}
|
||||
CustomField::truncate();
|
||||
factory(CustomField::class, 4)->create();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue