2016-10-05 108 views
-1

我试图构建一个laravel应用程序,我已经创建了所有的迁移文件。但是,当我试图运行Laravel:[PDOException] SQLSTATE [42S02]:找不到基表或视图

php artisan migrate 

命令,我看到了以下错误:

[Illuminate\Database\QueryException] 
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'atom.users' does 
    n't exist (SQL: select exists(select * from `users`) as `exists`) 

    [PDOException] 
    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'atom.users' does 
    n't exist 

我尝试更新的作曲家和迁移:回滚但同样的错误,我越来越每当我运行的命令。此外,也没有与.env文件的错误以及。我找不到错误,如果有人可以帮助我找到问题..谢谢。

这里是我的user表迁移文件:

<?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('email')->unique(); 
      $table->string('password'); 
      $table->rememberToken(); 
      $table->timestamps(); 
     }); 
    } 

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

您是否创建了原子数据库? –

+0

是的..我确实有一个名为atom的数据库 – Hola

+0

运行命令'composer dump-autoload'并重试.. –

回答

0

这里是我上的用户迁移历史。

PHP工匠制作:AUTH
PHP工匠制作:模型用户
PHP工匠制作:模型用户--migration PHP工匠迁移:安装
sudo的PHP的工匠迁移:安装
sudo的PHP的工匠制作:迁移
sudo的PHP的工匠制作:迁移用户

顺便说一句,你的迁移文件看起来不错,但希望这将帮助你

如果它不,尝试在db表中“伪造”一些数据,然后重试...

0

运行:php artisan clear-compiled然后再次运行您的迁移。

相关问题