option('database'); if ($databaseId) { $databases = SourceDatabase::where('id', $databaseId)->get(); if ($databases->isEmpty()) { $this->error("Database with ID {$databaseId} not found."); return Command::FAILURE; } } else { $databases = SourceDatabase::where('is_active', true)->get(); } if ($databases->isEmpty()) { $this->info('No source databases configured.'); return Command::SUCCESS; } $totalChanges = 0; foreach ($databases as $database) { $this->info("Checking schema changes for: {$database->name}"); $changes = $comparisonService->checkForChanges($database); if ($changes->isEmpty()) { $this->info(' No changes detected.'); } else { $this->warn(" Found {$changes->count()} change(s):"); foreach ($changes as $change) { $this->line(" - {$change['description']}"); } $totalChanges += $changes->count(); } } $this->newLine(); $this->info("Total changes detected: {$totalChanges}"); return Command::SUCCESS; } }