Skip to content

Commit

Permalink
Output SQL before running migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
curder committed Nov 16, 2023
1 parent b0d115a commit 652de3c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/partials/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,17 @@ return new class extends Migration
}
};
```
:::
:::
## 运行迁移之前输出 SQL
当输入 `php artisan migrate --pretend` 命令时,在终端中会列出待执行的 SQL 查询。
如果需要的话,这是一种调试 SQL 的有趣方法。
```
php artisan migrate --pretend
# 2023_11_16_025540_whatever_you_want ....................................
# ⇂ alter table `products` add `description` varchar(255) null after `name`
```

0 comments on commit 652de3c

Please sign in to comment.