Add SQL query for migrating branch data from prm_cabang table
- 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.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?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;');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user