[英]SQLSTATE[42S02] Problem with artisan tinker
I have a problem with artisan tinker Problem:我对工匠修补程序有疑问:
Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.projects' doesn't exist (SQL: insert into `projects` (`title`, `description`, `updated_at`, `created_at`) values (My first Project, bla bla, 2020-12-18 14:21:42, 2020-12-18 14:21:42))'
my migration file:我的迁移文件:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class BusinessTable extends Migration
{
/**
* Выполнение миграций.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('mail');
$table->string('web-site');
$table->timestamps();
});
}
/**
* Отмена миграций.
*
* @return void
*/
public function down()
{
Schema::drop('business');
}
}
your problem dosent do anything with Business Migration.您的问题与商业迁移无关。
how ever your business migration should be:您的业务迁移应该如何:
Schema::create('business',
not flights
.不是flights
。 its about Project Table.它关于项目表。
you have to create a project migration:你必须创建一个项目迁移:
php artisan make:migration projects_table
and populate with required fields:并填写必填字段:
class ProjectsTable extends Migration
{
/**
* Выполнение миграций.
*
* @return void
*/
public function up()
{
Schema::create('projects', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('description');
$table->timestamps();
});
}
/**
* Отмена миграций.
*
* @return void
*/
public function down()
{
Schema::drop('projects');
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.