90 lines
2.7 KiB
PHP
Executable File
90 lines
2.7 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class ReInitializeDB extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
// Liste de toutes vos tables
|
|
$tables = [
|
|
'agents',
|
|
'codeGenerer',
|
|
'demandeAdhesion',
|
|
'demandeCredits',
|
|
'identifications',
|
|
'networks_agents',
|
|
'networks_operators',
|
|
'nh_acts',
|
|
'nh_authorization_of_care_requests',
|
|
'nh_drugs_and_devices',
|
|
'nh_exams',
|
|
'nh_having_rights',
|
|
'nh_health_care_sheets',
|
|
'nh_health_care_sheets_exams',
|
|
'nh_health_care_sheets_history',
|
|
'nh_health_care_sheets_performances',
|
|
'nh_health_care_sheets_prescriptions',
|
|
'nh_insurances',
|
|
'nh_insurances_having_rights',
|
|
'nh_insurances_invoices',
|
|
'nh_insurances_payments',
|
|
'nh_insurances_subscriptions',
|
|
'nh_insurances_subscriptions_history',
|
|
'nh_medical_prescriptions',
|
|
'nh_months_prices_grid',
|
|
'nh_networks_configs',
|
|
'nh_performances',
|
|
'nh_provider_classes',
|
|
'nh_tmp_health_care_sheets',
|
|
'nh_validating_agents',
|
|
'nh_years_prices_grid',
|
|
'operators',
|
|
'operators_countries',
|
|
'payment_transactions',
|
|
'regulations',
|
|
'transfert_commission_transaction',
|
|
'transmitting_networks',
|
|
'type_operators',
|
|
'users',
|
|
'users_banking_account_verification',
|
|
'users_demandes_credits',
|
|
'users_epargnes',
|
|
'users_groups',
|
|
'users_groups_demandes_validations',
|
|
'user_bank_accounts',
|
|
'wallets',
|
|
'walletsPassword',
|
|
'wallets_users',
|
|
'wallet_ilink_transaction',
|
|
'wallet_recharge',
|
|
'wallet_transaction'
|
|
];
|
|
|
|
$this->command->info('Désactivation des contraintes de clés étrangères...');
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
|
|
|
foreach ($tables as $tableName) {
|
|
if (Schema::hasTable($tableName)) {
|
|
$this->command->info("Tronquage de la table : {$tableName}");
|
|
DB::table($tableName)->truncate();
|
|
} else {
|
|
$this->command->warn("La table {$tableName} n'existe pas, elle a été sautée.");
|
|
}
|
|
}
|
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
|
$this->command->info('Réinitialisation terminée avec succès !');
|
|
|
|
}
|
|
}
|