Mindastic
Mindastic

Reputation: 4121

Problems with migrations in Laravel 5.5

Something really weird is going on with my Laravel setup. I create some migration files and, when running php artisan migrate after creating each of them, they were successfully run and the tables were created in the database. Now, if I want to run php artisan migrate:refresh --seed, it cannot rollback one of the migrations because it says that migration file doesn't exist. This is the error: It says the migration was not found And this is my migration file: The file exists!

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAssessmentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('assessments', function (Blueprint $table) {
            $table->increments('id');
            //TODO - Complete information for this table
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('assessments');
    }
}

What's even weirder is that I had to re-create all migrations because it was randomly not creating some of the tables listed on the migrations.

Did anyone face this issue before? Any help is really appreciated.

[UPDATE]

After a while, I realized this is not something from Laravel. For some reason, my Homestead is not viewing those files despite there are there. If I access that folder via SSH (the one inside the vagrant box), the file is not there. If I go to the real folder, it is there. For some reason the box is not synching files properly. What's even weirder is that I can access and edit the file inside the VMB but it won't list it and won't take into account when running migrations. Here I created a screen-recording showing the problem.

[UPDATE 2]

Just recorded 2 more videos. This is really strange (unless I am missing something).

Video 1.

Video 2.

Upvotes: 0

Views: 332

Answers (1)

Mindastic
Mindastic

Reputation: 4121

It seems to be a problem with MacOS High Sierra and Vagrant. In order to fix it, I had to apply this workaround.

Hopefully this will save some time to the ones having the same problem I was having.

Upvotes: 1

Related Questions