Laravel Base表或视图未在新的新数据库中找到

时间:2018-04-17 04:49:39

标签: mysql laravel migration

我遇到了以下错误:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist

所以,经过几个小时试图找到错误,我放弃并做了以下事情:

  • 我对所有事情做了备份。
  • 我“GIT”并创建了一个新的分支。
  • 我删除了数据库并使用新名称创建了一个新数据库。
  • 我在.ENV文件中声明了新数据库
  • 我删除了所有迁移,只让密码和用户迁移保持不变(新鲜)。
  • 我删除了日志文件并清空了\ storage \ framework \ views目录
  • 我重新启动了服务器。

基本上我有一个新的应用程序。我的目标是逐个迁移每个表以找出问题所在。

我运行第一次迁移(只是用户表和密码)

php artisan migrate

并得到完全相同的错误:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist

问题是:

如果我没有迁移并且新数据库有新名称,Laravel会存储有关表的信息吗?

编辑:我的迁移是新鲜的,开箱即用。新数据库具有相同的名称

用户表

<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug')->unique();
            $table->string('email')->unique();
            $table->string('password');
            $table->integer('role_id')->index()->default(3);
            $table->rememberToken();
            $table->timestamps();
        });
    }

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

Passwort

<?php

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

class CreatePasswordResetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('password_resets', function (Blueprint $table) {
            $table->string('email')->index();
            $table->string('token');
            $table->timestamp('created_at')->nullable();
        });
    }

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

0 个答案:

没有答案