【Laravel】artisanのdb:showコマンドを解説

チートシート

Laravel 10.x以降のartisanの「db:show」コマンドを解説します。

Description

データベースに関する情報を表示します。

Usage

php artisan db:show [--database [DATABASE]] [--json] [--counts] [--views]

Options

オプション省略形必須説明
database--データベース接続
json--データベース情報をJONとして出力する
counts--テーブルの行数を表示します
views--データベースビューを表示する
※1) 大規模なデータベースでは遅くなる事があります

Example

no options

php artisan db:show
  MySQL 8 ..........................................................................................................................................  
  Database ..................................................................................................................................... app  
  Host ....................................................................................................................................... mysql  
  Port ........................................................................................................................................ 3306  
  Username .................................................................................................................................... sail  
  URL ..............................................................................................................................................  
  Open Connections ............................................................................................................................... 1  
  Tables ......................................................................................................................................... 6  
  Total Size ............................................................................................................................... 0.09MiB  

  Table ................................................................................................................................. Size (MiB)  
  failed_jobs ................................................................................................................................. 0.02  
  migrations .................................................................................................................................. 0.02  
  personal_access_tokens ...................................................................................................................... 0.02  
  password_reset_tokens ....................................................................................................................... 0.02  
  users ....................................................................................................................................... 0.02  

counts

php artisan db:show --counts
  MySQL 8 ..........................................................................................................................................  
  Database ..................................................................................................................................... app  
  Host ....................................................................................................................................... mysql  
  Port ........................................................................................................................................ 3306  
  Username .................................................................................................................................... sail  
  URL ..............................................................................................................................................  
  Open Connections ............................................................................................................................... 1  
  Tables ......................................................................................................................................... 6  
  Total Size ............................................................................................................................... 0.09MiB  

  Table .......................................................................................................................... Size (MiB) / Rows  
  failed_jobs ............................................................................................................................. 0.02 / 0  
  migrations .............................................................................................................................. 0.02 / 7  
  personal_access_tokens .................................................................................................................. 0.02 / 0  
  password_reset_tokens ................................................................................................................... 0.02 / 0  
  users ................................................................................................................................... 0.02 / 0  

Source

10.x

framework/src/Illuminate/Database/Console/ShowCommand.php at 11.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.

11.x

framework/src/Illuminate/Database/Console/ShowCommand.php at 11.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.

コメント

タイトルとURLをコピーしました