to rollback only :
Rolled back: 2015_05_15_195423_alter_table_web_directories
php artisan migrate:roll
If you can't do what is told by @Martin Bean, then you can try another trick.
Create a new migration and on that file in up() method insert what's in down() method of the migration you want to rollback and in down() method insert what's in up() method.
e.g if your original migration is like this
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id')->unsigned();
$table->string('name');
});
}
public function down()
{
Schema::drop('users');
}
then in new migration file do this
public function up()
{
Schema::drop('users');
}
public function down()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id')->unsigned();
$table->string('name');
});
}
and then run the migrate, it will delete the table. and if you again want that back just rollback it.
If you want to rollback last migration.
php artisan migrate:rollback
If you want to rollback specific migration then go to migration table and set highest value of that record in batch. Then.
php artisan migrate:rollback
Currently i'm working on laravel 5.8 if not working any other version of laravel please inform to me.
Migrate tables one by one.
Change the batch number of the migration you want to rollback to the highest.
Run migrate:rollback.
May not be the most comfortable way to deal with larger projects.
INSERT INTO homestead.bb_migrations (`migration`, `batch`) VALUES ('2016_01_21_064436_create_victory_point_balance_table', '2')
something like this
As stated in the Laravel manual, you may roll back specific number of migrations using the --step
option
php artisan migrate:rollback --step=5
If you have access to the DB you have a easier solution. You can delete the record from migrations table and then just drop the table. with SQL client.
And Can use
php artisan migrate:rollback --path=...
Like many answers. And remember the path is Location. You can remove even module migration like this. (Any migration from anywhare)
php artisan migrate:rollback --path=Modules/YourModule/database/migrations/2020_05_15_xxxxxx_create_your_table.php
And remember, If you are using linux servers careful about case sensitivity. You have to add like /Database/Migrations with starting capital.
/Database/Migrations/2020_05_15_xxxxxx_create_your_table.php