使用 laravel 种子创建新的 table 时出错

Getting error when create new table with laravel seeds

这里 Laravel 非常新,如果问题很愚蠢,我很抱歉。我正在尝试创建新的 table 但收到此错误

[PDOException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'vvas.buildings' doesn't exist

这是我的种子

class CreateBuildingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('buildings', function (Blueprint $table) {
            $table->increments('id');
            $table->string('street');
            $table->string('neighborhood');
            $table->text('description');
            $table->timestamps();
        });
    }

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

当您想创建 table 时,您可以使用 Schema::createSchema::table 是修改现有的 table。所以在你的情况下是

....
Schema::create('buildings', function (Blueprint $table) {
....

在这里您可以找到更多关于 Database creation and migration

的信息

要创建一个新数据库table,请在 Schema facade 上使用 create 方法。

Schema facade 上的 table 方法可用于 更新现有的 tables.