-1

我对工匠修补程序有疑问:

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))'

我的迁移文件:

<?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');
    }
}
4

1 回答 1

0

您的问题与商业迁移无关。

您的业​​务迁移应该如何:

Schema::create('business',

不是flights。它关于项目表。

你必须创建一个项目迁移:

php artisan make:migration projects_table

并填写必填字段:

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');
    }
}
于 2020-12-18T15:03:01.543 回答