Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bilaliqbal049's avatar

Laravel Specific migration rollback possible?

php artisan migrate:rollback --path=database/migrations/2022_07_30_150944_create_posts_table.php

I used this command, but it does not remove specific migrations or drop tables from the database in Laravel 9. Has it possible to drop specific migrations? When I run this command, I get this message in the terminal.

INFO Rolling back migrations.

2022_10_13_172130_create_points_table .................................................................................. Migration not found

Here points are the latest migration. And I do not want to drop the latest migration by using step=1

0 likes
8 replies
Shivamyadav's avatar

Change your path set it the correct path using this forward slash "/database " before database and try it

path=/database/migrations/2022_07_30_150944_create_posts_table.php
bilaliqbal049's avatar

@Shivamyadav php artisan migrate:rollback --path=/database/migrations/2022_10_11_135154_add_destination_to_table_flights.php not working same error migration not found

1 like
Sinnbeck's avatar

Why would you want to roll back. It's better to move forward. Make a new migration that fixes the database

bilaliqbal049's avatar

@Sinnbeck Sir actually I use the same command before, and it works, but now it's not working. I have a useless table, that's why I want to drop it from database. Can you just confirm whether Laravel 9 has discontinued this option or not?

Sinnbeck's avatar

@bilaliqbal049 So the migrations has a down() for removing the table? Personally I would just create a new migration that removes the table. I think its broken due to the change to anonymous classes. I doubt anyone uses it so therefor no one noticed. If you change 2022_10_13_172130_create_points_table to a regular class, I bet it works. The command you ran is correct

bilaliqbal049's avatar

@Sinnbeck I pick an old project and run the same command and its works, that project was in 8.0, and it's not working in 9.19 if you have any idea whether Laravel 9 discontinue this command or not

maartenpaauw's avatar

If the migration is ran within a batch where only migration was executed, you could use the following command (where 12 represents the batch number):

php artisan migrate:rollback --batch=12

Please or to participate in this conversation.