Laravel在这里很新,如果问题很愚蠢,我很抱歉。我试图创建新表但收到此错误
[PDOException] SQLSTATE [42S02]:未找到基表或视图:1146表' vvas.buildings'不存在
这是我的种子
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');
}
}
答案 0 :(得分:1)
如果要创建表格,请使用Schema::create
。 Schema::table
是修改现有表格。所以在你的情况下会是
....
Schema::create('buildings', function (Blueprint $table) {
....
您可以在此处找到有关Database creation and migration
的更多信息 要创建新数据库表,请在架构外观上使用create
方法。
架构外观上的table
方法可用于更新现有表。