- 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.
27 lines
607 B
PHP
27 lines
607 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Migrators;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
class BranchesMigrator
|
|
{
|
|
public function migrate(): void
|
|
{
|
|
DB::table('branches')->truncate();
|
|
|
|
$path = database_path('data/tested/branches.json');
|
|
|
|
$rawData = File::json($path);
|
|
|
|
foreach ($rawData as $data) {
|
|
DB::table('branches')
|
|
->insert($data);
|
|
}
|
|
|
|
DB::statement("SELECT setval('branches_id_seq', (SELECT MAX(id) from branches));");
|
|
DB::statement("SELECT nextval('branches_id_seq');");
|
|
}
|
|
}
|