Skip to content
Discussion options

You must be logged in to vote

This happens because rollback only works if your migrations have a proper down() method defined. By default, Laravel’s migration stubs include both up() and down(). If you only wrote the up() method and left down() empty, Laravel has no instructions on how to reverse the migration.

Solution:

  1. Check your migration files:

    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->timestamps();
        });
    }
    
    public function down()
    {
        Schema::dropIfExists('posts');
    }
    • If down() is missing or empty, rollback won’t drop the table.
  2. Run rollback again:

    php artisan migrate:rollback
    • This will undo the …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@clarkeex
Comment options

Answer selected by clarkeex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants