From e562c250db8696f020ae2d66ba4e30e70c68f8fe Mon Sep 17 00:00:00 2001 From: Kris Date: Wed, 20 Dec 2023 21:34:01 +0100 Subject: [PATCH] :technologist: add migration script for stopovers (#2226) --- ...stopover_relation_id_in_train_checkins.php | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) rename app/Console/Commands/MigrateStopovers.php => database/migrations/2023_12_20_000000_migrate_stopover_relation_id_in_train_checkins.php (67%) diff --git a/app/Console/Commands/MigrateStopovers.php b/database/migrations/2023_12_20_000000_migrate_stopover_relation_id_in_train_checkins.php similarity index 67% rename from app/Console/Commands/MigrateStopovers.php rename to database/migrations/2023_12_20_000000_migrate_stopover_relation_id_in_train_checkins.php index eae68e51d..44cde919c 100644 --- a/app/Console/Commands/MigrateStopovers.php +++ b/database/migrations/2023_12_20_000000_migrate_stopover_relation_id_in_train_checkins.php @@ -1,21 +1,11 @@ orWhereNull('destination_stopover_id')->count() > 0) { TrainCheckin::with(['HafasTrip.stopovers', 'originStation', 'destinationStation']) ->whereNull('origin_stopover_id') @@ -31,11 +21,11 @@ public function handle(): int { ->first(); if ($originStopover === null) { - $this->error("Could not find origin stopover for checkin {$checkin->id}"); + echo "ERROR: Could not find origin stopover for checkin {$checkin->id}\n"; return; } if ($destinationStopover === null) { - $this->error("Could not find destination stopover for checkin {$checkin->id}"); + echo "ERROR: Could not find destination stopover for checkin {$checkin->id}\n"; return; } @@ -43,10 +33,8 @@ public function handle(): int { 'origin_stopover_id' => $originStopover->id, 'destination_stopover_id' => $destinationStopover->id, ]); - - $this->info("Migrated stopover ids for checkin {$checkin->id}"); + echo "."; }); } - return Command::SUCCESS; } -} +};