Home Laravel Base table or view not found in a new fresh database
Reply: 0

Laravel Base table or view not found in a new fresh database

user2992
1#
user2992 Published in May 22, 2018, 11:45 am

I came across the following error:

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

So, after hours trying to find the erroor I gave up and did the following:

  • I made a backup of everything.
  • I "GIT" and created a new branch.
  • I deleted the database and created a new one fresh with a new name.
  • I declare the new database in the .ENV file
  • I deleted all migrations and let just the passwords and user migrations unchanged (fresh).
  • I deleted the log file and emptied the \storage\framework\views directory
  • I restarted the server.

Basically I have a new app. My goal ist migrate one by one each table to figure out where the problem is.

I run the first migration (just user table and passwords)

php artisan migrate

and get the exact same error:

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

The question is:

Where Laravel store the information about tables if I have not migrations and a fresh database with a new name?

EDIT: My migrations are fresh, out of the box. The new database has the same name

Usertable

<?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');
    }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300705 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO