为什么php工匠什么都不迁移?

Cha*_*lug 5 php migration migrate laravel artisan

运行"php artisan migrate"什么都不做:没有数据库修改,没有消息(没有"无需迁移"),没有错误.

没有记录添加到表迁移中.

以前,命令"php artisan migrate"工作正常.

文件夹数据库/迁移中的一个迁移文件具有以下内容:

<?php

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

class VidsTableEdit14 extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
            $table->integer('test');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
        });
    }

}
Run Code Online (Sandbox Code Playgroud)

如何让"php artisan migrate"工作?

小智 0

当我尝试向表中添加软删除时,我也遇到了同样的情况。

我创建了迁移,并在 Schema::table 函数中输入了“$table->softDelete();”。代替

$table->softDeletes();
Run Code Online (Sandbox Code Playgroud)

请注意复数形式的“s”,我尝试运行迁移,但没有收到任何错误或消息。我把它改成复数并且有效。

我注意到你没有制作 down function()。尝试添加:

Schema::drop('vids');
Run Code Online (Sandbox Code Playgroud)

并再次运行迁移。