laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.51k stars 11.02k forks source link

Database migrations in pretend mode doesn't display insert statements to migrations table #52491

Closed Sn0wCrack closed 2 months ago

Sn0wCrack commented 2 months ago

Laravel Version

10.48.19

PHP Version

8.2

Database Driver & Version

MariaDB / MySQL

Description

When running the migrate command with the --pretend flag, I've noticed the insert statement that is run for adding a new entry into the migrations table is not output along with the create table and alter table commands.

I've noticed other insert commands that are executed within the migration, such as database seeders, are recorded in the output however.

Steps To Reproduce

Run php artisan migrate --pretend with currently pending migrations, only create tables, alerts and inserts from seeders are displayed.

Boorinio commented 2 months ago

I opened a pr for this, lets see https://github.com/laravel/framework/pull/52513

driesvints commented 2 months ago

Seems we're not going to take action here sorry.

Sn0wCrack commented 2 months ago

Seems we're not going to take action here sorry.

To be honest when I first noticed this I thought it was a bug not a feature.

When I run migrate with the pretend flag my expectation is that all database operations would be logged and I could run them all in the order they appear to achieve the same outcome as if I ran migrate without the pretend flag.

All other insert statements within a migration file, such as ones ran in the file itself or ran from within seeders, are logged. Thus my conclusion about this being a bug rather than intended.

Realistically if this was changed it would probably only save around 30 seconds of my day, so I'm honestly not fussed either way, but it does still seem to be a strange decision to me.