- Created a new SQL file `query_mig_users.sql` to select and transform user data. - The query retrieves user details including user ID, name, email, and various flags. - Includes a commented-out query to count total users per group.
22 lines
529 B
PHP
22 lines
529 B
PHP
<?php
|
|
|
|
namespace Modules\Usermanagement\Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class MigDeleteUsersButNot1Seeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// $this->call([]);
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
|
DB::table('users')->where('id', '!=', 1)->delete();
|
|
DB::statement("ALTER TABLE branches AUTO_INCREMENT = 2");
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
|
}
|
|
}
|