mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Fixed migration
This commit is contained in:
parent
16bd78fb3f
commit
0581499029
|
@ -16,23 +16,21 @@ class MakeAssetAssignedToPolymorphic extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
//
|
||||
$table->string('assigned_type')->nullable();
|
||||
});
|
||||
|
||||
// Prior to this migration, asset's could only be assigned to users.
|
||||
Asset::whereNotNull('assigned_to')->orWhere('assigned_to', '')->update(['assigned_type' => User::class]);
|
||||
Asset::whereNotNull('assigned_to')->orWhere('assigned_to', '!=', '')->update(['assigned_type' => User::class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
* @return voidatom
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('assigned_type');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue