2016-10-05 79 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然後再次運行您的遷移。

相關問題