3 minutes January 30, 2026

How can you safely preview Laravel migrations before running them?

Laravel migrations are a huge productivity win — but they can also be risky if you run them blindly.
Most migrations are harmless. A new column here, an index there.

But all it takes is one rushed deploy or one wrong migration to break a production database.

That’s why Laravel gives you a simple but powerful safety net:
php artisan migrate –pretend

This guide explains what the command does, why it matters, and when you should always use it.

The Problem: Risky Database Changes

Migrations often look innocent:

But behind the scenes, Laravel is generating real SQL that can:

  • Drop columns or tables
  • Modify data types
  • Lock large tables
  • Affect production data instantly

Once a migration runs, the damage is often irreversible without downtime.

Running migrations without knowing exactly what SQL will execute is one of the most common causes of broken production deployments.

The Solution: Migration Preview Mode

Laravel solves this with –pretend, a dry-run mode for migrations.

What it does:

  • Shows the exact SQL Laravel plans to execute
  • Does not run any queries
  • Leaves your database completely untouched

Laravel converts all pending migrations into raw SQL, prints them to the terminal, and stops.
No tables created. No columns dropped. No surprises.

What You’ll See in the Output

When you run the command, Laravel lists:

  • Each pending migration file
  • The exact SQL statements generated
  • The order in which they would run

Those highlighted queries are for review only — nothing is executed.

This gives you a clear, database-level view of what your migration will actually do.

Why This Matters in Real Projects

1. Prevents Costly Mistakes

–pretend gives you a final checkpoint before things go wrong:

  • Dropped columns
  • Missing nullable() constraints
  • Running migrations on the wrong database

You get one last chance to stop and fix the issue.

2. Reveals the Real SQL

Migrations are readable, but they hide complexity.
With –pretend, you can see:

  • Actual SQL queries
  • Chosen column types
  • Indexes, collations, and engine details

It’s one of the best ways to understand how Laravel translates schema changes.

3. Essential Before Production Deploys

A safe deployment flow looks like this:

 

Many teams won’t approve a production deployment without reviewing the pretend output first.

4. Improves Code Reviews

When reviewing migrations in a PR, –pretend helps you:

  • Spot dangerous SQL early
  • Catch missing indexes
  • Question destructive changes before they ship

Much easier than fixing a broken database later.

What –pretend Will NOT Do

Just to be clear:

  • Does not modify the database
  • Does not execute migrations
  • Does not update the migrations table

It is completely safe and risk-free.

Pro Tip: Combine With Step Mode

For even more control:

This shows migrations one by one, exactly how Laravel would apply them in step mode.

Conclusion: Make it a Deployment Habit

 

might feel optional —
until the day it saves you from a production outage.

After that, it becomes muscle memory.

Planning a production deployment or database migration?
Work with our Laravel experts

blog
Greetings! I'm Aneesh Sreedharan, CEO of 2Hats Logic Solutions. At 2Hats Logic Solutions, we are dedicated to providing technical expertise and resolving your concerns in the world of technology. Our blog page serves as a resource where we share insights and experiences, offering valuable perspectives on your queries.
Aneesh ceo
Aneesh Sreedharan
Founder & CEO, 2Hats Logic Solutions
Subscribe to our Newsletter
Aneesh ceo

    Stay In The Loop!

    Subscribe to our newsletter and learn about the latest digital trends.