Undefined table error: Extending User's Plugin

Undefined table error: Extending User's Plugin

我正在尝试扩展用户的 table 以向其添加更多字段,我在更新文件夹的 php 文件中将其作为我的代码。

<?php namespace Corymillz\Store\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class AddNewFeilds extends Migration
{

    public function up()
    {
        Schema::table('users', function($table)
        {
            $table->string('store_title')->nullable();
            $table->text('store_description')->nullable();
            $table->string('background_color')->nullable();
            $table->string('font_color')->nullable();
            $table->string('font_family')->nullable();
            $table->dateTime('last_seen')->nullable();
        });
    }
    public function down()
    {
        $table->dropDown([

            'store_title',
            'store_description',
            'background_color',
            'font_color',
            'font_family',
            'last_seen'
        ]);
    }
}

当我运行控制台中的刷新命令 php artisan plugin:refresh Corymillz.Store 我一直收到错误

undefined variable: table

我认为您的 down() 方法缺少代码

It should look like this

public function down()
{
    Schema::table('users', function($table) {
        $table->dropColumn([
            'store_title',
            'store_description',
            'background_color',
            'font_color',
            'font_family',
            'last_seen'
        ]);
    });
}    

In your code its complaining about $table variable as it was not defined, also instead dropDown you need to use dropColumn.

如有疑问请评论。