Laravel迁移找不到表

杰米

我有一个非常奇怪的问题。当我尝试迁移我的迁移时,我收到错误消息:

  [Illuminate\Database\QueryException]                                         
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cforum.ticket' d  
  oesn't exist (SQL: alter table `ticket` add `id` int unsigned not null auto  
  _increment primary key, add `title` varchar(255) not null, add `description  
  ` varchar(255) not null, add `user_id` int unsigned not null, add `subject_  
  id` int unsigned not null, add `status_id` int unsigned not null)  

我已经重新启动了服务器。这是票证迁移:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTicketTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('ticket', function (Blueprint $table) {

            $table->increments('id');
            $table->string('title');
            $table->string('description');

            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')
                ->references('id')->on('user')
                ->onDelete('cascade');

            $table->integer('subject_id')->unsigned();
            $table->foreign('subject_id')
                ->references('id')->on('subject')
                ->onDelete('cascade');

            $table->integer('status_id')->unsigned();
            $table->foreign('status_id')
                ->references('id')->on('status')
                ->onDelete('cascade');
        });
    }

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

在此处输入图片说明

这有什么问题吗?

韩林

改变:

Schema::table('ticket', function (Blueprint $table){

进入:

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

composer dump-autoload在您的控制台中使用希望对您有帮助=)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章