fixes #549: fill missing arrival dates and prevent setting arrival by admin-user instead of admin-arrive
parent
689735ad51
commit
db26412e6c
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Engelsystem\Models\User\State;
|
||||
|
||||
class FixMissingArrivalDates extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$states = State::whereArrived(true)->whereArrivalDate(null)->get();
|
||||
foreach($states as $state) {
|
||||
$state->arrival_date = $state->user->personalData->planned_arrival_date;
|
||||
$state->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Down is not possible and not needed since this is a bugfix.
|
||||
*/
|
||||
public function down()
|
||||
{}
|
||||
}
|
Loading…
Reference in New Issue