Laravel 10.xのartisanの「db:table」コマンドを解説します。
Description
データベースの指定したテーブルに関する情報を表示します。
テーブルの構造やカラム情報を確認するために使用できます。
Usage
php artisan db:table [--database [DATABASE]] [--json] [--] [<table>]Arguments
| 引数 | 必須 | 説明 |
|---|---|---|
| table | – | テーブルの名前 |
Options
| オプション | 省略形 | 必須 | 説明 |
|---|---|---|---|
| database | – | – | データベース接続 |
| json | – | – | テーブル情報をJSONで出力する |
Example
no options
php artisan db:table Which table would you like to inspect?
failed_jobs .................................................................................................................................... 0
migrations ..................................................................................................................................... 1
personal_access_tokens ......................................................................................................................... 2
password_reset_tokens .......................................................................................................................... 3
users .......................................................................................................................................... 4
❯ 表示したいテーブルを番号で選択できます。
table
php artisan db:table users users ............................................................................................................................................
Columns ........................................................................................................................................ 8
Size ..................................................................................................................................... 0.02MiB
Column ...................................................................................................................................... Type
id autoincrement, bigint, unsigned ........................................................................................................ bigint
name string ............................................................................................................................... string
email string .............................................................................................................................. string
email_verified_at datetime, nullable .................................................................................................... datetime
password string ........................................................................................................................... string
remember_token string, nullable ........................................................................................................... string
created_at datetime, nullable ........................................................................................................... datetime
updated_at datetime, nullable ........................................................................................................... datetime
Index ............................................................................................................................................
PRIMARY id ....................................................................................................................... unique, primary
users_email_unique email .................................................................................................................. unique


コメント