How to Change the Order of Migrations in Laravel

May 7th, 2025 • 1 minute read time

If you need to change the order of how migrations are run in Laravel, you just need to adjust the file name.

Here's an example list of migrations:

2025_04_03_100259_create_campaign_summary_table.php
2025_04_24_111856_add_issue_id_to_summaries_table.php
2025_04_25_082534_add_number_to_campaigns_table.php

Migrations in Laravel run in alphabetical order, in this case determined by the timestamp at the beginning of the file.

Here's the new order when we adjust one of the timestamps.

2025_04_01_082534_add_number_to_campaigns_table.php // Moved to the start
2025_04_03_100259_create_campaign_summary_table.php
2025_04_24_111856_add_issue_id_to_summaries_table.php

It's unlikely you'll need to change the order of migrations often, since you usually create them as you make changes. Occasionally however, you may create multiple migrations and realise you need to adjust the order after.

Happy migrating!

If you found this article helpful, you'll love our practical screencasts.
Author
Alex Garrett-Smith
Share :

Comments

No comments, yet. Be the first!

Tagged under