- Adjusted indentation in ActivityLogModule methods for consistency. - Simplified ActivityLogRepository class by removing unnecessary lines. - Updated FillJsonData seeder to streamline the run method. - Modified various Migrator classes to change JSON data paths for testing and added sequence reset statements for better database integrity.
33 lines
778 B
PHP
33 lines
778 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class CardPinOrdersMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
DB::table('card_pin_orders')->truncate();
|
|
|
|
$path = database_path('data/tested/card_pins.json');
|
|
|
|
$rawData = File::json($path);
|
|
|
|
foreach ($rawData as $data) {
|
|
if (! empty($data['deleted_at'])) {
|
|
continue;
|
|
}
|
|
|
|
unset($data['deleted_at']);
|
|
|
|
DB::table('card_pin_orders')
|
|
->insert($data);
|
|
}
|
|
|
|
DB::statement("SELECT setval('card_pin_orders_id_seq', (SELECT MAX(id) from card_pin_orders));");
|
|
DB::statement("SELECT nextval('card_pin_orders_id_seq');");
|
|
}
|
|
}
|