37 lines
920 B
PHP
37 lines
920 B
PHP
<?php
|
|
|
|
namespace App\OldDataMigrations;
|
|
|
|
class ProductsMigration extends BaseOldDataMigration
|
|
{
|
|
public function priority(): int
|
|
{
|
|
return 3;
|
|
}
|
|
|
|
public function migrate(): array
|
|
{
|
|
$results = [];
|
|
|
|
$results['products'] = $this->migrateTable('products');
|
|
$results['product_categories'] = $this->migrateTable('product_categories');
|
|
$results['product_variants'] = $this->migrateTable('product_variants');
|
|
|
|
$results['product_prices'] = $this->migrateTableWithoutColumns(
|
|
'product_prices',
|
|
['deleted_at'],
|
|
function ($row) {
|
|
$row['type'] = match ($row['type']) {
|
|
'grosir' => 'wholesale',
|
|
'harga_modal' => 'capital',
|
|
default => $row['type'],
|
|
};
|
|
|
|
return $row;
|
|
},
|
|
);
|
|
|
|
return $results;
|
|
}
|
|
}
|