summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2018-12-27 19:08:35 +0100
committermsquare <msquare@notrademark.de>2018-12-27 19:08:35 +0100
commitdb26412e6c155a40bca58cf2982911e1f3fb370c (patch)
tree23f96ff47c4ad12f8721e0f8762feb07a8703b9c /db
parent689735ad51a8ec7bd18c60be3407abf3bc17e228 (diff)
fixes #549: fill missing arrival dates and prevent setting arrival by admin-user instead of admin-arrive
Diffstat (limited to 'db')
-rw-r--r--db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php
new file mode 100644
index 00000000..b932158c
--- /dev/null
+++ b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php
@@ -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()
+ {}
+}