【问题标题】:Deleted migrations files still migrating已删除的迁移文件仍在迁移
【发布时间】:2021-06-09 16:57:12
【问题描述】:

我在我的 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');
    }
}

【问题讨论】:

  • php artisan migrate:refresh

标签: laravel laravel-8 laravel-migrations


【解决方案1】:

运行以下工匠命令:

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

【讨论】:

  • 还是一样,会不会是迁移文件来自一个包?
  • 我不这么认为,你能添加你的迁移表示例
  • 我只有来自 Laravel 的默认用户和 failed_jobs 迁移表。我注意到所有执行的迁移文件都与身份验证有关,所以我想它可能来自我使用的包。
  • 你是否运行了“php artisan migrate:fresh”,它会从你的数据库中删除你所有的表并运行你的迁移表。
  • 并检查您的数据库/迁移文件夹中有哪些表
【解决方案2】:

已修复。它来自laravel/passport

【讨论】:

    猜你喜欢
    • 2015-08-08
    • 1970-01-01
    • 2013-10-10
    • 2016-04-02
    • 2013-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多