How to check migration status?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Understanding the Laravel Migration Status and Best Practices for Production Servers
Introduction: In any application, managing the database is crucial as it stores the backbone of your data. Laravel provides a powerful migration system to handle this task. This blog post aims to guide you in checking the current state of your migrations and understanding what will be executed during a `php artisan migrate` command run on production servers.
Background: Laravel's Migration system organizes database changes into individual files, making it easier for developers to manage their database schema evolution over time. Additionally, each migration file is versioned, allowing the tracking of changes and reverting them if needed.
Checking Laravel Migration Status:
1. Preparation: Before checking the status or running any migrations, ensure you have a recent backup of your database for safety measures.
2. Terminal Command: Run the command below in your terminal to check the current migration status and see which migrations will be executed when executing `php artisan migrate`.
```shell
php artisan migrate:status
```
The output of this command is a list of all available migrations, with an asterisk (*) beside the ones that have already been run. This helps to identify which migrations have not yet been applied or need attention.
Best Practices for Production Servers:
1. Use Environments: Always keep your Laravel application running on different environments (development, staging, production) to ensure proper testing and validation before deploying changes to production. This allows you to run tests and check the migration status in each environment without impacting your live site users.
2. Create Snapshots: Take screenshots or export a database backup after running migrations during deployment. This helps keep track of the state of your database at any given time, making it easier for future reference or troubleshooting.
3. Test Migrations Thoroughly: Before running migrations on production, perform extensive testing on your local development and staging environments to ensure everything works as expected. This includes unit tests, integration tests, and manual testing if needed.
4. Rollback Migrations: In case of unexpected behavior or issues, you can roll back the migration to restore the previous state of your database. The Laravel command `php artisan migrate:rollback` can help with this process by rolling back the latest or all migrations.
5. Monitor Migration Logs: The Laravel application stores a log file for each migration run, including timestamps and user information. These logs are stored in your database and can be retrieved using `php artisan migrate:log`. Keeping track of this information is essential for auditing purposes and troubleshooting issues related to migrations.
Conclusion: Checking Laravel's migration status before any significant update on production servers ensures a smooth experience for both users and developers, reducing the risk of downtime or data loss. By following these best practices and incorporating them into your workflow, you can confidently maintain and evolve your application database structure with ease.