- Created a new SQL file `query_mig_branches.sql` to select and format branch data. - The query retrieves various fields including branch code, name, status, and contact information. - Data is trimmed to remove any leading or trailing whitespace. - Results are ordered by branch code for consistency.
23 lines
617 B
PHP
23 lines
617 B
PHP
<?php
|
|
|
|
namespace Modules\Basicdata\Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class MigDeleteBranchesButNot1UpdateKpno1Seeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// $this->call([]);
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
|
DB::table('branches')->where('id', '!=', 1)->delete();
|
|
DB::table('branches')->where('id', 1)->update(['name' => 'KPNO1']);
|
|
DB::statement("ALTER TABLE branches AUTO_INCREMENT = 2");
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
|
}
|
|
}
|