Skip to content

Commit

Permalink
Add MB in database table size.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchit288 committed Aug 2, 2024
1 parent 04e04ab commit ca7a024
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Commands/DBSummaryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function mysql(): int
public function pgsql(): int
{
$this->table(
['Database Name', 'Size', 'Table Count', 'Character Set'],
['Database Name', 'Size (MB)', 'Table Count', 'Character Set'],
[[
database_name(),
$this->getDatabaseSize(),
Expand Down
4 changes: 2 additions & 2 deletions src/Queries/DatabaseSizeClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function mysql(): string
public function pgsql(): string
{
$result = collect(
$this->select("SELECT pg_size_pretty( pg_database_size('".$this->database."') );")
$this->select("SELECT (pg_database_size('".$this->database."') / 1024 / 1024) AS size;")
)->toArray();

return reset($result)->pg_size_pretty ?? Constant::DASH;
return reset($result)->size ?? Constant::DASH;
}


Expand Down

0 comments on commit ca7a024

Please sign in to comment.