非常新的Laravel在这里,我很抱歉,如果问题是愚蠢的。我正在尝试创建新表,但得到这个错误
[PDOException]SQLSTATE[42S02]: Base table or view not found: 1146建筑物不存在
这是我的种子
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');
}
}
当您想要创建表时,您使用Schema::create
。Schema::table
是修改一个现有的表。在你的例子中是
....
Schema::create('buildings', function (Blueprint $table) {
....
在这里您可以找到关于数据库创建和迁移的更多信息
要创建一个新的数据库表,在Schema facade上使用 模式facade上的create
方法。table
方法可用于更新现有的表。