diff --git a/app/Console/Commands/CheckDb.php b/app/Console/Commands/CheckDb.php new file mode 100644 index 000000000000..6885c7585ec2 --- /dev/null +++ b/app/Console/Commands/CheckDb.php @@ -0,0 +1,153 @@ +entities as $entity) { + + + $count_db_1 = $entity::on('db-ninja-01')->count(); + $count_db_2 = $entity::on('db-ninja-02')->count(); + + $diff = $count_db_1 - $count_db_2; + + $this->logMessage("{$entity} DB1: {$count_db_1} - DB2: {$count_db_2} - diff = {$diff}"); + + if($diff != 0) + $this->logMessage("{$entity} out of sync!!!!!"); + + } + + } + + private function logMessage($str) + { + $str = date('Y-m-d h:i:s').' '.$str; + $this->info($str); + $this->log .= $str."\n"; + } + +}