Add more info.

This commit is contained in:
James Cole 2021-05-01 07:14:43 +02:00
parent 1c2b14868b
commit 8ffe08bfb9
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -105,7 +105,7 @@ class FixPostgresSequences extends Command
$highestId = DB::table($tableToCheck)->select(DB::raw('MAX(id)'))->first(); $highestId = DB::table($tableToCheck)->select(DB::raw('MAX(id)'))->first();
$nextId = DB::table($tableToCheck)->select(DB::raw(sprintf('nextval(\'%s_id_seq\')', $tableToCheck)))->first(); $nextId = DB::table($tableToCheck)->select(DB::raw(sprintf('nextval(\'%s_id_seq\')', $tableToCheck)))->first();
if(null === $nextId) { if(null === $nextId) {
$this->line(sprintf('nextval is NULL for table "%s"', $tableToCheck)); $this->line(sprintf('nextval is NULL for table "%s", go to next table.', $tableToCheck));
continue; continue;
} }
@ -120,6 +120,9 @@ class FixPostgresSequences extends Command
$this->warn(sprintf('Arff! The nextval sequence is still all screwed up on table "%s".', $tableToCheck)); $this->warn(sprintf('Arff! The nextval sequence is still all screwed up on table "%s".', $tableToCheck));
} }
} }
if ($nextId->nextval >= $highestId->max) {
$this->info(sprintf('Table "%s" autoincrement is correct.', $tableToCheck));
}
} }