Fix oci migration picture on products
This commit is contained in:
Jérémy Munsch 2023-09-06 18:13:38 +02:00
parent 042e78583e
commit e381de5e9c
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC

View file

@ -99,13 +99,12 @@ return new class extends Migration
$this->fixForeignKeyActionOnProcesses();
// ! DEV: Comment this after running once, to develop a migration without remigrating every temp table.
$this->createAndFillTempTables();
// $this->createAndFillTempTables();
// * Migrate PRODUCTS, comment all except the one you want to develop here.
$this->migrateBrands();
$this->migrateProducts();
// ! DEV: Add a die here to develop migration and prevent droping temp tables
// dd('');
@ -347,7 +346,9 @@ return new class extends Migration
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
$pictureKey = $files ? $files->map(fn (string $filePath, string $fileName) => $fileName)
->first(fn ($fileName) => preg_match('/ref-[0-9a-z]*.jpg/', $fileName) !== false) : null;
->first(function ($fileName) {
return preg_match('/(ref-?[0-9a-z]{0,}.jpg)/', $fileName) === 1;
}) : null;
$picture = $files ? $files->get($pictureKey) : null;
if ($files) {
$files->pull($pictureKey);