Laravel database migration simulator

Laravel migrations are a great way to keep track of database changes, but, if you screw one your migrations, you’ll likely be left in a broken state where a rollback can do nothing.

If you are using PostgreSQL, wrapping the whole migration in a transaction is a quick and clean way to avoid this headache. Unfortunately this is not the case for MySQL ( at least as of version 5.7 ), a transaction has no effect on table operations.

One way to go about it is to keep your migrations small, preferably performing one simple operation per migration.

The other way is way better, clean and will have no effect on the live database even if all your migrations fail: it’s by instructing Laravel to run the migrations against a testing database and report any error back.

After using this approach in my projects, I though it would be good to publish a package that does exactly that.


Leave a Reply