已删除的迁移文件仍在迁移

问题描述

删除了 laravel 应用程序中的一些迁移文件,但在我运行 PHP artisan migrate 命令后,它仍在迁移已删除的迁移文件。我已经尝试过 composer dump-autoload 并且清除缓存仍然相同。我错过了什么?

迁移示例:

<?PHP

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

class createusersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users',function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

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

解决方法

已修复。它来自laravel/passport

,

运行以下工匠命令:

1. php artisan config:cache
2. php artisan config:clear
3. php artisan cache:clear
4. php artisan route:clear
5. php artisan view:clear

然后运行:

composer dump-autoload

之后运行迁移命令:

php artisan migrate:fresh