oci_migration fix wrong keywords associated with products

This commit is contained in:
Jérémy Munsch 2023-09-11 09:57:57 +02:00
parent 8e48fc5ea1
commit 923c3e0f6a
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC

View file

@ -24,6 +24,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\ItemNotFoundException;
use Illuminate\Support\Str;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
@ -140,7 +141,7 @@ return new class extends Migration
->explode(PHP_EOL)->map(fn (string $other_allegation) => Str::of($other_allegation)->squish())
->unique();
$MOTKS = Keyword::all();
$MOTKS = Keyword::query()->where('keyword_cat', 'LIKE', 'product_%')->get();
/** @var \Illuminate\Support\Collection<string,string> */
$START_SOURCES = $this->getQuery('SOURCE')->get();
/** @var \Illuminate\Support\Collection<string,string> */
@ -239,7 +240,7 @@ return new class extends Migration
fn (Keyword $keyword) => Str::of($keyword->label)->ascii()->replace(' ', '')
== Str::of($motk)->trim()->ascii()->replace(' ', '')
);
} catch (\Exception) {
} catch (ItemNotFoundException) {
dump(
$motk,
$MOTKS->pluck('label')