Display console messages during the migration

This commit is contained in:
Antoine Le Gonidec 2024-07-08 12:59:47 +02:00
parent 3f48a3cf60
commit a735b8aa2b
Signed by: vv221
GPG key ID: 636B78F91CEB80D8

View file

@ -7,6 +7,7 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Symfony\Component\Console\Output\ConsoleOutput;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class AddMailboxIdColumnToCustomersTable extends Migration {
@ -31,10 +32,13 @@ class AddMailboxIdColumnToCustomersTable extends Migration {
->onDelete('cascade');
});
// Link Customers to Mailboxes, through their Conversation information.
$output = new ConsoleOutput();
$output->writeln('<info>Linking existing Customers to Mailboxes, it might take a couple minutes…</info>');
$customers = Customer::all();
$customers->each(function ($customer) {
$customer->linkToMailboxThroughConversations();
});
$output->writeln('<info>Linking existing Customers to Mailboxes done.</info>');
}
/**