diff --git a/app/Console/Commands/MigrateCaCertificates.php b/app/Console/Commands/MigrateCaCertificates.php deleted file mode 100644 index 4c2fb6e..0000000 --- a/app/Console/Commands/MigrateCaCertificates.php +++ /dev/null @@ -1,80 +0,0 @@ -info('Starting CA data migration...'); - - // Check if source table exists - if (!DB::connection('mysql')->getSchemaBuilder()->hasTable('ca_certificates')) { - $this->error('Source table "ca_certificates" does not exist in the default connection.'); - return 1; - } - - // Check if target table is empty - $count = CaCertificate::count(); - if ($count > 0 && !$this->option('force')) { - $this->error("Target table is not empty (contains $count records). Use --force to proceed."); - return 1; - } - - // Fetch from old DB - $oldCerts = DB::connection('mysql')->table('ca_certificates')->get(); - - $this->info("Found {$oldCerts->count()} certificates to migrate."); - - $bar = $this->output->createProgressBar($oldCerts->count()); - $bar->start(); - - foreach ($oldCerts as $cert) { - // We use the Model to insert into the new DB (since it's now bound to 'mysql_ca') - // Using replicate() or manual array creation - - $data = (array) $cert; - - // Ensure we don't duplicate if it already exists (upsert-like behavior or strict check) - if (CaCertificate::where('uuid', $data['uuid'])->exists()) { - if ($this->option('force')) { - // Update existing - CaCertificate::where('uuid', $data['uuid'])->update($data); - } else { - // Skip - } - } else { - CaCertificate::create($data); - } - - $bar->advance(); - } - - $bar->finish(); - $this->newLine(); - $this->info('Data migration completed successfully.'); - - return 0; - } -} diff --git a/app/Console/Commands/NotifyCertificateExpirations.php b/app/Console/Commands/NotifyCertificateExpirations.php index 28c2c0f..c55c394 100644 --- a/app/Console/Commands/NotifyCertificateExpirations.php +++ b/app/Console/Commands/NotifyCertificateExpirations.php @@ -11,7 +11,7 @@ class NotifyCertificateExpirations extends Command * * @var string */ - protected $signature = 'certificates:notify-expiring'; + protected $signature = 'trustlab:notify-expiring'; /** * The console command description.